In this simple code fragment, the first printf displays 32767, but the second displays the correct value for the length of theName.
Why?
char theName[50];
int theLength;
printf("enter your name: ");
scanf("%s", theName);
theLength==(int)strlen(theName);
printf("your name is %s , and it is %d characters long.\n",theName,theLength);
printf("your name is %s , and it is %d characters long.\n",theName,(int)strlen(theName));