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

Write a C program in Fibonacci series.

622


What does %d do in c?

535


What is indirection in c?

615


What is null character in c?

683


why wipro wase

1821






Write a program of prime number using recursion.

608


What is meant by operator precedence?

664


What does the c in ctime mean?

557


What is the role of && operator in a program code?

561


What is c programming structure?

614


A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?

1766


Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

573


Do you know the difference between exit() and _exit() function in c?

603


How is null defined in c?

645


What is this pointer in c plus plus?

586