what is void pointer?
Answer / himaja
pointers can also be declared as void type.void pointers cant be dereferenced without explict type conversion,this is becoz being void the compiler cnt determine the size of object that pointer points to,though void vaariables declared is not allowed,thus void p displays error msg "size of p is unknown or 0" after compilation
#include<stdio.h>
int p;
float d;
char c;
void *pt=&p;
void main(void)
{
clrscr();
*(int*)pt=12;
printf("\n p=%d",p);
pt=&d; /*pt points to d*/
*(float*)pt=5.4;
printf("\n r=%f",d);
pt=&c; /*pt points to c*/
*(char*)pt=H;
printf("\n c=%c",c);
o/p:
P=12
R=5.4
C=H
| Is This Answer Correct ? | 6 Yes | 0 No |
the question is that what you have been doing all these periods (one year gap)
how would a 4*3 array A[4][3] stored in Row Major Order?
What is volatile variable how do you declare it?
hi how to convert program from notepad to turboc editor can u please help me
What is the output of below code? main() { static in a=5; printf("%3d",a--); if(a) main(); }
who did come first hen or agg
how to find your architecture is LittleEndian or BigEndian?
Why can't I perform arithmetic on a void* pointer?
Is main() is used in the program,,see below example? void main() { int i; for(i=0;i<10;i++) main(); } Then what is the output of the program?
How many levels of pointers have?
the expression a=30*1000+2768; evalutes to a) 32768 b) -32768 c) 113040 d) 0
int x=sizeof(!5.856); What will value of variable x?