C: Why is it not possible to scan strings from keyboard in case of array of pointers to string?
Why is it not possible to scan strings from keyboard in the case of an array of pointers to strings?
When an array is declared, the dimension of the array should be specified so that the compiler can allocate memory for the array. When an array of pointers to strings is declared its elements would contain garbage addresses. These addresses would be passed to scanf( ). So strings can be received but they would get stored at unkown locations. This is unsafe.




Comments
Log in or create a user account to comment.