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

Answer Posted / ashish

here a is an array and is a char const * data type.
hence u cannot change value of a but u can change the value
which a points to.
p on the other hand is a const char * data type.
hence value of p an be changed but the value p points to
cannot be changed.




i dont know the answer!!! :P

Is This Answer Correct ?    3 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is c called a mid-level programming language?

939


Is it possible to pass an entire structure to functions?

740


What are all different types of pointers in c?

761


What is a class c rental property?

841


What is the purpose of void pointer?

775


What are loops c?

796


What is #error and use of it?

894


What is a spanning Tree?

1217


Which is best book for data structures in c?

797


In a switch statement, what will happen if a break statement is omitted?

803


Why clrscr is used in c?

779


number of times a digit is present in a number

1765


How can I trap or ignore keyboard interrupts like control-c?

803


What is action and transformation in spark?

815


What is the use of getchar() function?

826