Sunday, August 2, 2009

Can anyone tell me in C language, the difference between character array and string array?

A character array consists of single characters. A string array consists of groups of characters.

Can anyone tell me in C language, the difference between character array and string array?
you are a real curious boy.





character array= a line of characters. note there is always a null char in every char array.





null char= a "bank" space/char==no actual use =p








string array is a actually the same.


string= line of "something"


array= a specific line of string





hope that helped you =p
Reply:The Character array is group of characters (in their ASCII codes).


They are generally one dimensional.





There is no termination symbol for this.





BUt the string array is group of strings (which is again group of characters)


It is mandatory to have two dimensional array for a string array.





String array is terminated with '\0'
Reply:In C a charachter array is a array storing charachters. A string is a charachter array ending with '\0' character which marks end of string. A charachter array containing 'a', 'b', 'c', 'd', '\0', 'e', 'f', 'g' is a charachter array with 8 charachters, but is a string with 4 charachters as fifth element '\0' marks the end of string.





When you say string array, it can mean a array of pointers each pointing to a string.
Reply:A character array consist of single characters while string array consist of s group of characters.
Reply:A string is a character array.


A string array is an array of strings.


No comments:

Post a Comment