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

What are the 5 types of organizational structures?

546


What is the importance of c in your views?

586


What are directives in c?

539


List some applications of c programming language?

544


while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above

732






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

628


Multiply an Integer Number by 2 Without Using Multiplication Operator

315


Write a program of prime number using recursion.

613


Write the syntax and purpose of a switch statement in C.

616


What does c mean before a date?

585


What is a pointer value and address in c?

628


Is c high or low level?

574


Define recursion in c.

695


Which is better pointer or array?

592


Do you know what are bitwise shift operators in c programming?

581