Character arrays and Strings in C
It is a general misconception that both character arrays and strings are one and the same. But, THEY ARE NOT THE SAME. If you already know the difference between them, then I hope this post will add a little more to what you already know. What are character arrays and strings? let's first see what they have in common. A character array and string are both sequence of characters i.e, they store the base address of multiple characters in sequence and these characters can be accessed using index value. Here is what happens when you initialize a character array: //character array: char ch_arr [ 3 ] = " abc " ; /* DESCRIPTION: *here, *ch_arr[0] stores 'a' *ch_arr[1] stores 'b' *ch_arr[2] stores 'c' */ Here's what happens when you initialise a string: //string: char str [ ] = " abc " ; /* DESCRIPTION: *here, *str[0] stores 'a' *str[1] stores 'b' *str[2] stores 'c' * additiona...