Is that about stack? i think the last *p++ is undefined.*p++ means *(p++) or *p;p++;?
void test123()
{
char s[] = "123", * p;
p = s;
// 1 2 3
cout << *p++ << endl;
cout << *p++ << endl;
cout << *p++ << endl;
}
void test321()
{
char s[] = "123", * p;
p = s;
//321
cout << *p++ << *p++ << *p++ << endl;
}
int main(void)
{
cout << "123:" << endl;
test123();
cout << "123:" << endl;
test321();
cout << "hello world" << endl;
return 0;
}
i think the result is undefined
Aucun commentaire:
Enregistrer un commentaire