Array C Programing



A string is a sequence of characters. Any sequence or set of characters defined within double quotation symbols is a constant string.


Array is the collection of homogenous data elements. It means all the elements stored in array will be of same type. Array can collect multiple values of data. When we declare a variable, it will store only one value in it.

But in the case of array multiple values we can stored in the array. String is a collection of characters. Array of
character elements also called string.


Difference between a String and an Array of Characters

A string is any collection of characters which is terminated by a special character null character (‘\0’). So string is an array of character whose last element is null character (‘\o ’). String must be declare in a double quotes i.e. " ".

For Example: Char name[] = {"Rohit Negi"};
An Array of character is just like any other array. Here characters are store in the place of array element. It must not terminate with null character ('\0').

Generally we use single quotes for Array of chars.

For Example: Char name [] = { 'R','o','h','i','t',' ','N','e','g','i'} Both string and Array of character can be accessed by Index Value of Array.