What is the difference between character array and string in C?

Questions by ravi.dokania   answers by ravi.dokania

Showing Answers 1 - 5 of 5 Answers


  • Feb 6th, 2007

I think there is nothing difference b/w both because string is a collection of character or we can say it is a character array which ends at NULL.

  Was this answer useful?  Yes


  • Jan 31st, 2008

IN C there is no big diffrence Between string and character array
 but string must be NULL terminated...... if u ll forget to insert the '' at the END it will automatically insert the NULL chracter .take a example

int i;
char arr[5]={'a','s','d','z','x'};  \no error because not a string..it is collection of chracter
char arr1[5]="asdzx";   //error overflow because last chracter must be
char arr2[6]="asdzx";//will work
for (i=0;i<5;printf("n%d----%cn",i,arr[i]),i++);

printf("nstringn ");
printf("nstring-----is ----%sn",arr1);

hi,guys..this is amit what i feel abto arrayand string i already written ..if u have any other views plz send me at amitsrms21@gmail.com

  Was this answer useful?  Yes


  • Feb 8th, 2008

    string is a collection of charecter,it must be ended with null.
     charecter array is aset of elements if you didn't give a space for null,it shows error.
   if any correction or further infn plz send it to me.


  Was this answer useful?  Yes


  • Dec 26th, 2011

char arr2[6]="asdzx";//will work

this instruction never work....

  Was this answer useful?  Yes


  • Feb 8th, 2012

the major difference between the char array and the string is that the array will not end with the null....where as string ends with the null.............

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account

Send   Reset


Related Answered Questions


Related Open Questions