When my program runs, the IF ( ch[0] == 'P') actually puts the value 'P' into ch[0]. Any ideas what is happening here? The output is: "Array is Pyz"
char *try1(char ch[]);
int main()
{
char ch[] = { 'x','y','z' }, *ch1;
ch1=try1(ch);
printf("\nArray is %s\n",ch1);
return 0;
}
char *try1 (char ch[])
{
if (ch[0]=='P')
{
ch[1]='Q';
}
return ch;
}
Aucun commentaire:
Enregistrer un commentaire