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

How do you search data in a data file using random access method?

825


What happens if header file is included twice?

648


When do we get logical errors?

631


Explain continue keyword in c

576


Is c object oriented?

534






What are the application of c?

637


How to set file pointer to beginning c?

658


Tell me is null always defined as 0(zero)?

664


What is %g in c?

609


What is spaghetti programming?

664


When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?

577


How do I get an accurate error status return from system on ms-dos?

639


Can we initialize extern variable in c?

626


What is the purpose of 'register' keyword in c language?

620


the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

1793