I did some google search on this already. The problem is I just find explanation what a char pointer or char pointer pointer does and simply what an array of char pointer is. Actually my program is working. Simply when I close my eyes and accept everything the world is just fine but I constantly get some questions flashing in my mind, which I cant answer. Long story short I hope nobody will kill me for my question, since it could seem trivial to some of you,obviously it is not to me! So her we go:
char *pc;
char **ppc;
char *string[2] = {"Hello","World",};
ppc = string;
pc = *ppc;
printf("%p\n",ppc);
printf("%p\n",&pc);
printf("%p\n",*ppc);
printf("%p\n",pc);
printf("%p\n",&string[0]); //or &string
printf("%c\n", **ppc);
printf("%s", *ppc);
after running this I was expecting *ppc to be the address of first string (first character of first string), which is not and I was also expecting kind of relation between &pc and ppc which is also not the case. ppc is a pointer to pointer, but I literraly have no clue about the pointer which ppc is pointing before reaching the first element of string? I am sorry if this all sounds stupid, but I really want to understand it. Any help will be appreciated!


*ppcis the address of the first string - see the output of your lastprintf%pexpects a pointer-to-void, so you must cast each of these arguments to(void*). Also,&string[0]and&stringpoint to the same address, but different things. One says: "that's Mr. String", and the other "That's Mr. String's head".%plines invoke undefined behaviour. Read the man-page carefully and use the correct type.