Strings in C Programming Language

Notes:

Strings in C Programming Language

String:
- is a sequence (or array) of characters enclosed in between pair of double quotations
- indicates textual data

// declaring and initializing an array of characters
char arrayName[size] = “sequence of characters”;
Ex:
char player1Name[7] = ”Ramesh”;

where: size = total number of characters in a given string + 1; because a string in C language is terminated with an extra character called as null ( ‘\0’ ) character

OR

// declaring and initializing a pointer to a string
char * pointerVariableName = “sequence of characters”;
Ex:
char * player2Name =”Suresh”;