If you use
Code:
strcpy(name, "John");
in the function, you will see that "John" persists.
When you have a function declared like
Code:
void GetData(int& number, char name[]);
It is exactly the same as if you had
Code:
void GetData(int& number, char *name);
And as a matter of fact when you call the function, the second argument is always treated as "char *name", even if you had declared it as "char name[]". That is and always has been a part of the C language (therefore C++).
In your function, consider the statement
[code]
name = "John";
[code]
This sets the local copy of "name" to point to the C constant array, but does not affect anything in the calling program.
The strcpy() that I suggested above actually copies "John" into the array, so that the main program prints out "John".
There is nothing special about char arrays, the same is true for other arrays. In the C language there is no "string" data type; standard library functions for manipulating strings (strcat, strlen, etc.) are based on having strings represented as null-terminated arrays of char.
Regards,
Dave