Mask-group

Strings in C



  • The group of characters are stored together in a character array.This character array is known as strings.

  • Each character occupies 1 byte of memory and the last character of the string is always \0.

  • Example:

char name[]={’G’,’A’,’T’,’E’,’\0’};

‘\0’ is called a null character.

The terminating null (‘\0’) is important, because it is the only way the functions that work with a string can know where the string ends. 

C inserts the null character automatically. 

We can simply initialize a string and print its elements using a while loop.