what is difference between array of characters and string

Answer Posted / shayan

the main difference between array of char and string is that when we declare array of char like char name[6],in this case for example shayan s is stored in 0 index and last character is n which is at 5 index but i delared 6 because 6th index is of null character which is neccesary to declare but in string it will automatically declare by the compiler like "shayan" after n compiler automatically put \0 after n.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an auto keyword in c?

639


write a c program in such a way that if we enter the today date the output should be next day's date.

1677


string reverse using recursion

1805


What are the types of pointers?

596


Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.

679






How to write c functions that modify head pointer of a linked list?

539


How are portions of a program disabled in demo versions?

745


Where are local variables stored in c?

570


Where can I get an ansi-compatible lint?

634


What is the general form of #line preprocessor?

581


What are the 5 data types?

597


What is the use of sizeof?

551


What are formal parameters?

652


What is the difference between array and pointer in c?

576


What is gets() function?

667