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

Answer Posted / srinivas

a is a const pointer, whereas p is not
meaning 'a' will point to a fixed location (value of 'a' or
address of *a can't change, remains fixed) - though
contents of a can be changed (by way of accessing a[i])

Is This Answer Correct ?    36 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are the standard predefined macros?

897


What are the 4 types of organizational structures?

850


Sir i need notes for structure,functions,pointers in c language can you help me please

2199


Explain goto?

942


Which is more efficient, a switch statement or an if else chain?

794


Can main () be called recursively?

902


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

987


write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

1950


What does. int *x[](); means ?

853


Why is it that not all header files are declared in every C program?

930


Does c have function or method?

811


What is the c value paradox and how is it explained?

824


What is the g value paradox?

879


How do you print only part of a string?

805


Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?

844