I ran across this code on a web tutorial. I am curious about the use of the sizeof operator whichis being used to determine the size of an array:
char answer, *p;
fgets(answer, sizeof answer, stdin);
if((p = strchr(answer, '
')) != NULL)
*p = '';
printf("You typed "%s"
Why would this return the size of the array, and not the size of type pointer to char?