0
Usage of *p[ ]
How can I use a pointer *p[3] without using any array to store multiple strings in C program?
3 ответов
+ 6
`char *p[3]` says "p is an array of 3 pointer to char" which indicates it's already an array and you're gonna store some C-string on that like so
char *p[3] = {"First", "Second", "Third"};
0
How will you use it without assigning strings beforehand ?
0
You have to either set a size for each char* (with malloc or as static arrays) and set the first character to 0 (so that it is a string and not only a char*)
Then, it depends on what you want to do after that. With malloc solution, you may want to use it after some user inputs