Join ExamsbookAnswer :
How would you find the length of each string in the following Program?
main()
{
char *str[] = { "Frogs", "Do", "Not" , "Die" , "They" , "Croak!"};
printf ("%d%d", sizeof (str), sizeof (str[0]));
}5
Q: How would you find the length of each string in the following Program? main() { char *str[] = { "Frogs", "Do", "Not" , "Die" , "They" , "Croak!"}; printf ("%d%d", sizeof (str), sizeof (str[0])); }
- Show AnswerHide Answer
- Workspace
Answer :
Explanation :
main() { char *str[] = { "Frogs", "Do", "Not", "Die." , "They", "Croak!" }; int i; for ( i = 0;i<=5;i++) printf ("\n%s%d", str[i], strlen( str[i])); }