I am trying to improve my programming skill and i've tried the exercise in my text book. I would like to ask a questions here:
char strng[] = " Hooray for All of Us ";
char *messPt;
messPt = &strng[0];
for(int i=0;i<20;i++)
cout << *(messPt + i) << " ";
cout << endl;
messPt = strng;
while(*messPt++!= '\0')
cout << *messPt ;
cout << endl;
and this is the output :
H o o r a y f o r A l l o f U
Hooray for All of Us
My questions are :
actually at the end of the second output , there is a ? but it's in the reverse form. May anyone explain to me why this happen?
if i declare the char like this : char strng[] = "Hooray for All of Us"; The second output become like this : ooray for All of Us
Thanks in advance :)
messPtin thewhile()conditional and only after you stream it intocout...