for example
#include<stdio.h> int foo = 100; int bar() { int foo; /* local foo = global foo, how implemented? */ return 0; } int main() { int result = bar(); return 0; }
i think in function bar, calling foo directly global foo. how can refer local foo? know in c++, there pointer. however, c has similar?
thanks lot!
no, declaring foo
in bar()
, have taken global foo
out of scope. inside bar()
when refer foo
local variable.
Comments
Post a Comment