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

Answer Posted / dharanidhar

P is a pointer which is constant. So, the values in this
array cannot be modified.

characters within a[] can be changed by accessing
like a[1] = '2',....

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why we use break in c?

536


What is meant by 'bit masking'?

868


What is the easiest sorting method to use?

625


What is c method?

520


In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none

695






What is the use of header?

607


How can I split up a string into whitespace-separated fields?

556


Is c procedural or object oriented?

561


Is calloc better than malloc?

560


How to declare a variable?

556


Without Computer networks, Computers will be half the use. Comment.

1857


Can two or more operators such as and be combined in a single line of program code?

792


Is it better to use a macro or a function?

637


Explain what is the purpose of "extern" keyword in a function declaration?

605


What is assignment operator?

615