R
rabbitlzx
Unregistered / Unconfirmed
GUEST, unregistred user!
#include <iostream>
using namespace std;
void main()
{
char s[]= "desolate";
char* p = s;
cout<<"*p++ == " <<*p++ <<endl;
cout<<"*(p++) == " <<*(p++) <<endl;
cout<<"(*p)++ == " <<(*p)++ <<endl;
cout<<"*++p == " <<*++p <<endl;
cout<<"*(++p) == " <<*(++p) <<endl;
cout<<"++*p == " <<++*p <<endl;
cout<<"++(*p) == " <<++(*p) <<endl;
}
运行结果:
*p++ == d
*(p++) == e
(*p)++ == s
*++p == o
*(++p) == l
++*p == m
++(*p) == n
===================================
那个*(p++) == e 是怎么回事呢?不理解
using namespace std;
void main()
{
char s[]= "desolate";
char* p = s;
cout<<"*p++ == " <<*p++ <<endl;
cout<<"*(p++) == " <<*(p++) <<endl;
cout<<"(*p)++ == " <<(*p)++ <<endl;
cout<<"*++p == " <<*++p <<endl;
cout<<"*(++p) == " <<*(++p) <<endl;
cout<<"++*p == " <<++*p <<endl;
cout<<"++(*p) == " <<++(*p) <<endl;
}
运行结果:
*p++ == d
*(p++) == e
(*p)++ == s
*++p == o
*(++p) == l
++*p == m
++(*p) == n
===================================
那个*(p++) == e 是怎么回事呢?不理解