wats the diference btwen constant pointer and pointer to a
constant.pls give examples.
Answer Posted / rudra prasad panda
Pointer is a variable containing the addres of another
variable;
Constant pointer is a variable which points to a variable
constantly.it means that , once it is initialised,it cannot
be changed.Till the end of program,it points to that
variable only;
EXAMPLE:
char k,m;
const char *p=&k;
p=&m;//(syntax error)
********
A pointer to a constant is a pointer such that the contents
of the variable(pointed by the pointer)cannot be modified
throuhg the pointer;
EXAMPLE:
char m='l';
char * const p;
p=&m;
*p='u';//syntax error
m='k';//no syntax error
| Is This Answer Correct ? | 8 Yes | 42 No |
Post New Answer View All Answers
Apart from dennis ritchie who the other person who contributed in design of c language.
#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }
Explain the bubble sort algorithm.
#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }
Ow can I insert or delete a line (or record) in the middle of a file?
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?
What are the difference between a free-standing and a hosted environment?
Do you know the use of 'auto' keyword?
Is the exit() function same as the return statement? Explain.
What are 3 types of structures?
How to compare array with pointer in c?
Explain how do you generate random numbers in c?
What do the functions atoi(), itoa() and gcvt() do?
Explain how can you tell whether two strings are the same?
What is the use of gets and puts?