+ 1
why output llo? could explain? #include <iostream> using namespace std; int main() { char *pString="hello"; pString+=2; cout<<pString; }
2 Answers
+ 1
Because pstring has first base add of hello i.e add of h and then it is incremented by 2 so pstring has now address of l and so it pints llo
+ 1
the char type stores the whole word and return the index requested in the cout. in that case it request for the third character and thats the first "L" it printa the rest as the pointer stores the whole word at once, hope that helps.