differentiate between
const char *a;
char *const a; and
char const *a;

Answer Posted / vignesh1988i

const char *a : means the string is constant and the pointer
is not...

const char *a="HELLO WORLD" , if we take this example for
the whole scope of the program the string is constant and we
can't assign any other string to that pointer 'a'....

char * const a : means the pointer is constant (address) but
string is not......

char * const a="hello world" , if we take this example ,
here the address will be always constant.... string can vary..

char const *a : means string is a constant and pointer is
not..... as we have seen from the first example...


thank u

Is This Answer Correct ?    37 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is printf () in c?

576


What is meant by inheritance?

624


What are type modifiers in c?

615


What are the key features in c programming language?

605


How can I sort a linked list?

630






What functions are used in dynamic memory allocation in c?

588


How do you do dynamic memory allocation in C applications?

625


What is difference between class and structure?

564


Write a program to print ASCII code for a given digit.

679


The statement, int(*x[]) () what does in indicate?

640


What is a substring in c?

582


What is a program?

653


Explain how can I read and write comma-delimited text?

646


List the difference between a While & Do While loops?

627


What are the advantages of using macro in c language?

585