what is difference between array of characters and string

Answer Posted / kapil kumar verma iimt meerut

when we declare array of char it has to be terminated by
null but termination by null in case of string is
automatic.the compiler automatically puts a null char when
we insert a string for example "kapil" for the
string "kapil\0", but for a char array we need assign a
place for it for example a[6] contains five char & a null
char.& secondly
when char array is read through scanf() input function then
spaces are not allowed if characters is read as string
(through gets() function) spaces are allowedand are treated
as a single char.

Is This Answer Correct ?    38 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why enum is used in c?

524


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

650


Wt are the Buses in C Language

2749


What is a const pointer in c?

668


When do we get logical errors?

633






write a program to rearrange the array such way that all even elements should come first and next come odd

1758


Why is c called "mother" language?

855


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

7387


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

632


write a program fibonacci series and palindrome program in c

630


Is that possible to add pointers to each other?

894


Explain what is gets() function?

625


Is malloc memset faster than calloc?

612


FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above

619


What is difference between union and structure in c?

572