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

Answer Posted / karuna

a[] is a constant pointer to a string;

char *p is a pointer to a constant string;

In a[] address of a[] cant be change but string can be
change.

In char *p address can be change string cant be change

Is This Answer Correct ?    15 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which driver is a pure java driver

1219


How can I discover how many arguments a function was actually called with?

816


What is c language used for?

711


How many levels of indirection in pointers can you have in a single declaration?

800


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

2506






Why do we need volatile in c?

921


What is #include cctype?

783


Can we declare function inside main?

739


Can we replace the struct function in tree syntax with a union?

989


What are the applications of c language?

822


What do you understand by friend-functions? How are they used?

902


Write a program of prime number using recursion.

804


How can I determine whether a machines byte order is big-endian or little-endian?

806


explain what is a newline escape sequence?

851


while initialization of array why we use a[][2] why not a[2][]...?

2066