Ccpp Arrays Strings — Free C Cpp Tutorial
Learn Ccpp Arrays Strings in C Cpp with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.
TL;DR: Learn Ccpp Arrays Strings in C Cpp with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.
Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated
Ccpp Arrays Strings in C Cpp
An array is a fixed-size, contiguous block of elements of the same type: `int a[5];`. Indexing is 0-based, so valid indices are 0..4. C does NOT check array bounds — writing a[5] or a[100] compiles and runs but corrupts memory (a leading cause of crashes and security bugs). You must track the length yourself.
A C string is just an array of char terminated by a special null character '\0'. So "Hi" occupies 3 bytes: 'H', 'i', '\0'. Functions in <string.h> — strlen, strcpy, strcmp, strcat — rely on that terminator to know where the string ends. Forgetting the '\0' leads to reads running off the end.
Arrays decay to a pointer to their first element when passed to a function, which is why a function receiving an array cannot know its length via sizeof — you pass the length as a separate argument.
Learn Ccpp Arrays Strings step by step with Syllab's free interactive C Cpp tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full C Cpp course →