This is C code snippet:
int main()
{
char *names=[ "tom", "jerry", "scooby" ];
printf("%s", *names[0]);// prints t
printf("%s", *names[1]);// prints j
// how to print full word "tom", or full word "jerry"
}
As stated earlier, I want my output to be: tom jerry scooby So using pointers how do I print the whole thing?
char *namestochar *names[]. Remove*beforeprintfarguments. Look at this: ideone.com/bokCN5namesto be an array of pointer, otherwise it can only hold 1 string. Also the[should be a{.{}instead of[]to enclose intializers.