Array Initialization in C
Arrays can be initialized at the time of declaration with values enclosed in braces and separated by commas.
Syntax. data-type array-name[size] = {val1, val2, ..., valn}; where,
val1: Value for the first element, val2: Value for the second element, valn: Value for the nth element.
Examples:
Character Array Initialization:
Character arrays are used for strings in C, automatically including a null character \0 at the end.
Examples:
char thing[4] = "TIN"; // Equivalent to {'T', 'I', 'N', '\0'}
char thing[] = "TIN"; // Automatically includes '\0'