mercredi 23 mai 2018

Why is this the output using pointing p++

**I dont know why is it the result , I thought the poiny p should be the address of str. And the output should always be the address in the while loop ,but why the result is the real value of str like that. someone could help me? **

char str[] = "we are poor students";//这是一个字符串
cout<<str<<endl;
char *p = str;
while (*p != '\0')
{
cout << p<<endl;
p++;
}
return 0;

result

Aucun commentaire:

Enregistrer un commentaire