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 |
What is 2c dna?
Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014 Npu university
The C language terminator is a.semicolon b.colon c.period d.exclamation mark
How the C program can be compiled?
What are the Advantages of using macro
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
What is default value of global variable in c?
Explain b+ tree?
How can I find out the size of a file, prior to reading it in?
# define x=1+4; main() { int x; printf("%d%d",x/2,x/4); }
What is a scope resolution operator in c?
Are pointers integer?