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
What is the use of pointers in C?
What are pointers in C? Give an example where to illustrate their significance.
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
Explain the difference between call by value and call by reference in c language?
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
Is there any possibility to create customized header file with c programming language?
What are enums in c?
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
How can a number be converted to a string?
Should a function contain a return statement if it does not return a value?
What is array of structure in c programming?
What is the use of typedef in c?
Can we add pointers together?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
Tell me when would you use a pointer to a function?