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

develop algorithms to add polynomials (i) in one variable

1734


What is hashing in c?

638


How can I convert a number to a string?

604


What is getch c?

847


Is it possible to initialize a variable at the time it was declared?

755






‎How to define structures? · ‎

622


What is the data segment that is followed by c?

604


Explain what is a const pointer?

634


why programs in c are running with out #include? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

1314


What are the Advantages of using macro

679


How can you restore a redirected standard stream?

606


What is a floating point in c?

598


What is typeof in c?

601


What is else if ladder?

603


What is a null pointer in c?

591