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 |
Identify the operators that is not used with pointer a. && b. # c. * d. >>
WRITE A C PROGRAM TO FIND SECOND BIGGEST VALUE FROM THE GIVEN VALUES
What is the size of empty structure in c?
In C program, at end of the program we will give as "return 0" and "return 1", what they indicate? Is it mandatory to specify them?
int i; i=2; i++; if(i=4) { printf(i=4); } else { printf(i=3); } output of the program ?
what is the purpose of the following code, and is there any problem with the code? void fn(long* p1, long* p2) { register int x = *p1; register int y = *p2; x ^= y; y ^= x; x ^= y; *p1 = x; *p2 = y; }
How to Throw some light on the splay trees?
how can i get output like this? 1 2 3 4 5 6
What's the difference between calloc() and malloc()?
What is the difference between procedural and declarative language?
difference between object file and executable file
how to go with this?