What is the difference between char a[] = "string"; and
char *p = "string"; ?

Answer Posted / srinivas

a is a const pointer, whereas p is not
meaning 'a' will point to a fixed location (value of 'a' or
address of *a can't change, remains fixed) - though
contents of a can be changed (by way of accessing a[i])

Is This Answer Correct ?    36 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are qualifiers in c?

568


Why c is called top down?

620


Is the exit() function same as the return statement? Explain.

654


What is the use of header files?

594


Does free set pointer to null?

551






What is #include called?

565


write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list

2225


What is difference between structure and union?

593


What is meant by int main ()?

712


What is use of integral promotions in c?

660


What are valid signatures for the Main function?

695


Explain b+ tree?

616


Explain the properties of union.

607


Here is a neat trick for checking whether two strings are equal

558


What does the c preprocessor do?

613