KNOW MORE ABOUT STRINGS
String
A string is traditionally a sequence of characters, either as a literal constant or as some kind of variable in Computer Programming Language.A string is generally considered as a data type and is often implemented as an array data structure of bytes that stores a sequence of elements, typically characters, using some character encoding.
— String is used to manipulate text such as word or sentences.
–The difference between a character array and a string is the string is terminated with a special character ‘\0’.
Declaration of strings: Declaring a string is as simple as declaring a one-dimensional array.
Ex : char str_name[size]
Initializing a String: A string can be initialized in different ways.
1. char str[] = “RAISEACAD NITK”;
2. char str[50] = “RAISEACAD NITK”;
3. char str[] = {‘R’,’A’,’I’,’S’,’E’,’A’,’C’,’A’,’D’,’ ‘,’N’,’I’,’T’,’K’,’\0′};
4. char str[14] = {‘R’,’A’,’I’,’S’,’E’,’A’,’C’,’A’,’D’,’ ‘,’N’,’I’,’T’,’K’,’\0′};