18.07.2011, 18:10
Quote:
Its normal because var its global variable and you formating 2texts.
|
Why the global variable has changed?
The reason is because all varialbles which have [](have dimensions) are acting same as pointers. So, you can chage their value via other function if they are in parameters of that function.
Same thing happens in Dev C aswell.
EDIT: It doesn't even need to be global variable if you want to change it. See example below.
pawn Код:
main()
{
new var[10];
var="Hey";
printf("%s",var);// this should print 'Hey'
Function(var);
printf("%s",var);// this should print 'Hi'
}
Function(var[])
{
var="Hello";
}