← C Programming learning pathC Programming · Module 6 of 10
Arrays and strings
Store many values in arrays; strings are char arrays ending with \0.
📖 Key ideas
- int marks[5]; holds 5 ints, indexed 0 to 4.
- C does not check array bounds; going past the end is a serious bug.
- A string is a char array ending with the null character \0.
- string.h gives strlen, strcpy, strcmp, strcat.
- Use fgets (not gets) to read a line of text safely.
💡 Real-life example: An array is a row of numbered seats; a string is a word written in those seats with a full stop (\0) at the end.
ArrayFixed-size list of same-type values
\0Null character that ends a string
strlenLength of a string
strcmpCompares two strings