Scope & binding nonsense university test
Scope & binding nonsense university test
I'm preparing an exam: but in the past exams on scope and bindings, I always see exercises with this kind of problem. Does this program not go in an infinite loop? Am I wrong?
int x = 200;
int n = 100;
int h()
write(n+x);
void foo (int f(), int n)
int x = 4;
int n = 3; //HERE IS THE PROBLEM THAT CAUSE INFINTE LOOP IMO
int g()
write(n+x);
if (n==0)
int x = 40;
int n = 30;
f();
h();
else
foo(f, 0);
foo(h, 1);
What will the program print with static scope and deep binding?
(This is the question in the exam, but I noticed that in all of these kinds of exercises there's this problem so I think I am wrong about something)
0
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.