1. const
char *a;
2. char* const a;
3. char const *a;
-Differentiate the above
declarations.
Answer:
1. 'const' applies to char *
rather than 'a' ( pointer to a constant char )
*a='F' : illegal
a="Hi" : legal
2. 'const' applies to
'a' rather than to the value of a
(constant pointer to char )
*a='F' : legal
a="Hi" :
illegal
3. Same as 1.
Blog Author: Vijay Kumar
No comments:
Post a Comment