I'm trying to figure out how 2d char array looks like in the memory. for example:
char c[][5]={"xa","ccc","bb","j","a","d"};
printf("TEST: %u %u %u %u \n\n",c[0],*c[0],c[0]+1,*(c[0]+1));
output:
TEST: 3214246874 120 3214246875 97
c[0]=*(c+0) is the string "xa", and equals to 3214246874, so I guess c[0] is the address to the char array "xa". when I put a * to c[0], I got 120 which is 'x' in ascii.
so I think the first space in c array is an address to the char x. after that I tried the same with c[0]+1, and it printed the next address, and then i put * and i got ,97 which is 'a' in ascii.
so I assumed the array c looks like this:
c[0] c[1]
------------------------------------------------------------------
| pointer to x | pointer to a ||| pointer to c | pointer to c | etc ...
----------------------------------------------------------------------
but I searched the web and I didnt find any proof for my assumption.
%uinvokes UB.