what is the difference between
const char *p, char const *p, const char* const p
Answer Posted / kumar krishna
CONST char *p;
here the const. keyword is coming before the "*p"
So it affects the value pointed by "p" i.e. "*p"
You can't change the character (value pointed by p).
Although you can change the address stored in "p".
char CONST *p;
same explanation as above
char * CONST p;
here the const. keyword is coming before the "p" and
after "*" So it affects the value of "p" (which holds
the address). You can't change the address stored in
"p". Although you can change the value pointed by p
i.e. "*p"
CONST char* CONST p:
here CONST is coming before the "*" as well as after
the "*". Therefore, as expeected neither the address
of nor the value pointed by "p" can be changed.
| Is This Answer Correct ? | 170 Yes | 11 No |
Post New Answer View All Answers
#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }
What is c language in simple words?
What is the general form of #line preprocessor?
How many main () function we can have in a project?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)
What is typedef example?
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
code for replace tabs with equivalent number of blanks
hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm
hi, which software companys will take,if d candidate's % is jst 55%?
Explain what does it mean when a pointer is used in an if statement?
Explain how can you restore a redirected standard stream?
What do you know about the use of bit field?
How can you increase the allowable number of simultaneously open files?