what is diffrence between string and character array?



what is diffrence between string and character array?..

Answer / vadivelt

By default String always ends with NULL character ie., '\0'.

But in character array manually it is needed to terminate
with NULL(You can do this, only when you wanted to use
character array as string)

Eg;

char *p = "Vadivel"; /*By default string is terminated
with '\0'*/

char array[8] = {'V','a','d','i','v','e','l','\0'};
/*Here terminated manually*/

Is This Answer Correct ?    9 Yes 1 No

Post New Answer

More C Interview Questions

Is it possible to execute code even after the program exits the main() function?

0 Answers  


How to add two numbers without using arithmetic operators?

18 Answers   College School Exams Tests, e track, Infosys, Pan Parag, Sapient, TCS,


explain what is a newline escape sequence?

0 Answers  


can we define a function in structure?

2 Answers  


main() { int a=0; if(a=0) printf("Ramco Systems\n"); printf("India\n"); } output?

7 Answers   Ramco,


Explain what is the difference between far and near ?

0 Answers  


Is c programming hard?

0 Answers  


Rapunzel walks into the forest of forgetfullness. She meets a Lion who lies on Monday Tuesdays and Wednesdays and meets a rabbit who lies on Thurs fridays and saturdays . On that day both say that "I lied yesterday". What day is it .

3 Answers   TCS,


Write a program in c to print 1 121 12321 1234321 123454321

11 Answers   ANR, College School Exams Tests, Mu Sigma, Wipro,


main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }

0 Answers   Wilco,


write a Program to dispaly upto 100 prime numbers(without using Arrays,Pointer)

26 Answers   ADITI, iFlex, Infosys, Oracle, TCS, Unicops, Wipro,


Is c an object oriented programming language?

1 Answers  


Categories