Why do we need strings?

Using char datatype, we can store a single character.


Example

char c1=a;  //characters are enclosed by single quotes
char c2=*;




How can we store a word or line?

Like "india", "java programming" etc.

We can store sequence of characters using string.




What is string?

String an array of characters terminated by null character ‘\0’.

Strings are enclosed by double quotes whereas characters are enclosed by single quotes.

Example

"India"

"C programming"

"etc etc"


String

The string must be terminated by the null character '\0'.

'\0' character denotes the end of a string which will be useful when we process the string.