August Karlstrom
2007-02-19 22:59:43 UTC
Hi everyone,
What should the following program print and why? With the OO2C compiler
I get 0 but I think it should be 1.
MODULE Test;
IMPORT Out;
PROCEDURE Q(p: PROCEDURE); BEGIN p END Q;
PROCEDURE P;
VAR n: LONGINT;
PROCEDURE Inner; BEGIN INC(n) END Inner;
BEGIN
n := 0;
Q(Inner);
Out.Int(n, 0); Out.Ln
END P;
BEGIN
P
END Test.
Regards,
August
What should the following program print and why? With the OO2C compiler
I get 0 but I think it should be 1.
MODULE Test;
IMPORT Out;
PROCEDURE Q(p: PROCEDURE); BEGIN p END Q;
PROCEDURE P;
VAR n: LONGINT;
PROCEDURE Inner; BEGIN INC(n) END Inner;
BEGIN
n := 0;
Q(Inner);
Out.Int(n, 0); Out.Ln
END P;
BEGIN
P
END Test.
Regards,
August