A quick pointer question
My code is divided in two source files. One of the source files includes main, the other one some functions I wrote.
In the source file where main is, I declare the global variable
And pass it to a function defined in the other source file:
Quick question... will the function "function" work with the address of the global variable defined in the other source file, or will it receive a new copy of "hello" and work with that?
void function(char *hello); // the prototype
It's a pointer, so it's the same array.
OK thanks, I thought so, just had a small doubt.
another relative quick question.
the function on the other file is prototyped
but hello is also a global variable, won't it get mixed up since a local variable is named just like a global?
void function(char *hello);
The local variable will "hide" the global variable.
The global variable will exist but is unaccessible due to the local variable hello.
This can be circumvented in C++, but not C.
i'm learning C++ little by little at the same time I do a lot of stuff...
I don't know exactly how I could circumvent it, but I bet I need to use the scope operator :: right?
int a = 2;
void foo(int a)
cout << a << endl;
cout << ::a << endl;
int __cdecl _tmain(int /*argc*/, TCHAR* /*argv*/, TCHAR*)