I know other questions have been asked about this topic but I could not find one for exactly what I am looking for. I am taking a course on C and was presented with the following challenge: "Create a new application and create four character arrays to hold the following lines of text:
'Roses are Red. Violets Are Blue. C Programming is Fun. And Sometimes Makes my Head Hurt.' Make sure your character arrays are large enough to accommodate the character used to terminate C strings. Using a correctly formatted printf() command and signifier, output the string array values. "
Here is the code I have so far:
#include <stdio.h>
int main()
{
char firstLine [] = "Roses are red.";
char secondLine [] = "Violets are blue.";
char thirdLine [] = "C programming is fun";
char fourthLine [] = "And sometimes makes my head hurt";
}
Instead of manually counting the number of characters in each array and then putting that number in the "[]", is there a way to determine the length of character in each string?