0

How the memory allocation is done for a char pointer array and double pointer.

char *s[]={"knowledge","is","power"}; 
char **p;
 p=s;
 cout<<++*p<<*p++<<++*p<<endl;

In the above code output is -- nowledge nowledge s

My question is just , how the values are assigned to pointer p and how it's incremented.

T.g
  • 169
  • 2
  • 11
  • 2
    Because this is undefined behavior. – Sam Varshavchik Aug 17 '18 at 17:22
  • 1
    I don't understand your question. Maybe, if you provided a [mcve], the expected and the actual output, your question would become much clearer. Also, in case you are struggling with the English language, maybe there is a Stackoverflow cousin in a different language. I also wouldn't mind having it here in two languages, so that people could help you translate. – Ulrich Eckhardt Aug 17 '18 at 17:23
  • Here output provided in question is output given by compiler. my question is just , how these values are assigned and updated. – T.g Aug 17 '18 at 17:25

0 Answers0