Can anyone explain me what is a difference between these lines of code
char *p = "String";
char p2[] = "String";
char p3[7] = "String";
In what case should I use each of the above ?
This link should satisfy your curiosity.
Basically (forgetting your third example which is bad), the different between 1 and 2 is that 1 allocates space for a pointer to the array.
But in the code, you can manipulate them as pointers all the same -- only thing, you cannot reallocate the second.