const char *a and char const *a are equivalent and 'a' can point to any variable(even that is not constant) but the thing 'a' points to cannot be changed and dont need initialisation
const chat * a;//legal char c='b';//legal a=&b;//legal *a='d';//illegal c='d';//legal but char * const a --represents a is constatnt pointer that points to a char.so, It needs an initialisation that will be unchanged for its life time. char c='b'; char * const a=&c; *a='d';//legal char d='e'; a=&d;//illegal On Thu, Jun 7, 2012 at 1:22 AM, g4ur4v <[email protected]> wrote: > > 1. const char *a; > 2. char* const a; > 3. char const *a; > > For each of the above, which operation below is legal and which is > not? > > *a='F' > a ="Hi" > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
