V
Virtual_X
if we use char[] in a function parameter like that
void st(char x[])
{cout << x;}
and char* as a parameter in the same function instead of char x[]
what would be different
in my experiments i conclude that
with char[] i can change the assigned value unlike char*
but in another question
why the value assigned to char[] when i change it in the function
it will also change the passed variable
ie:
void st(char x[])
{
x[0]= 'e';
cout << x;
}
int main()
{
char q[]= "CPP"
st(q);
cout << q;
}
in st(q) it will return "qPP" that logical
but
the second line will return the same result
HOW
i pass a variable not a reference and the function also don't accept
references
why the value changed in the result of the second line
void st(char x[])
{cout << x;}
and char* as a parameter in the same function instead of char x[]
what would be different
in my experiments i conclude that
with char[] i can change the assigned value unlike char*
but in another question
why the value assigned to char[] when i change it in the function
it will also change the passed variable
ie:
void st(char x[])
{
x[0]= 'e';
cout << x;
}
int main()
{
char q[]= "CPP"
st(q);
cout << q;
}
in st(q) it will return "qPP" that logical
but
the second line will return the same result
HOW
i pass a variable not a reference and the function also don't accept
references
why the value changed in the result of the second line