strings
A string is nothing but an array of characters, the difference between the string and the array of character is the string is terminated by the null character "\0".
we don't need to add the null character at the end of the strings compiler do that for us when the code is compiling.
In string, each character is going to take one byte and one extra byte is required to store the null character. so the size of the string is always going to the length of string + 1 bytes.
Declaration of string:
Declaration of sting is the same as the declaration of an array. but this time the data type is going to char because we are going to store characters inside the string.
char array_mane[size];
we need to include the null character in the size.
example:
char name[12];
char array[ 5 ];
Declaration of string with initializing elements:
1 char name[15] = { 'M' , 'y' , 'c', 'o', 'l', 'l', 'e', 'g', 'e', 'b', 'o', 'o', 'k', 's'};
2 char name[ ] = { 'M' , 'y' , 'c', 'o', 'l', 'l', 'e', 'g', 'e', 'b', 'o', 'o', 'k', 's'};
3 char name[15] = { "Mycollegebook" };
4 char name[ ] = " mycollegebooks";