I came across the following program under the title 'limitation of array of pointers to strings' in a C book. The book says that
"the program does not work since the array contains garbage values. And it would be definitely wrong to send these garbage values to scanf() as the addresses where it should store the strings received from the keyboard."
Code:main() { char *name[4]; int i; for(i=0;i<4;i++) { printf("Enter name"); scanf("%s",name[i]); } }
I tried executing the same program for integer numbers and it worked. I don't see why this does not work for strings.
Could anyone please help me with this?