0

Can anyone explain the output?

int main(){ char *p = "abcde"; cout << *p++; // consider necessary files are included } output :: a //actually i want to know what is happening in line 3. please explain it....

4th Aug 2017, 10:30 AM
LALIT NEGI
LALIT NEGI - avatar
2 odpowiedzi
+ 1
*p is a pointer to the string. It points to the 1st char which is "a" here. 3rd line prints the value of *p (i.e. a) and increments the pointer to make it point to b. If you write cout << *p; after 3rd line, you will see output as b.
4th Aug 2017, 2:01 PM
Gurpreet Singh
Gurpreet Singh - avatar
0
ok i got it thanks.....
4th Aug 2017, 2:04 PM
LALIT NEGI
LALIT NEGI - avatar