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

In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?

743


What is structure padding in c?

600


Why doesnt this code work?

598


Can you please explain the difference between malloc() and calloc() function?

589


Is file a keyword in c?

480






How to establish connection with oracle database software from c language?

1641


What's a good way to check for "close enough" floating-point equality?

601


what does static variable mean?

627


Is null valid for pointers to functions?

587


Explain about block scope in c?

634


What is a void * in c?

573


What is a function in c?

546


Is it possible to have a function as a parameter in another function?

568


How variables are declared in c?

538


What is #include conio h?

564