Answer Posted / 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 |
Post New Answer View All Answers
Why array is used in c?
‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .
What are the complete rules for header file searching?
Write a program to use switch statement.
What is property type c?
What's the best way of making my program efficient?
What do you mean by command line argument?
How can I manipulate individual bits?
shorting algorithmS
C program to find all possible outcomes of a dice?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
What is 02d in c?
Can you please explain the difference between syntax vs logical error?
What’s the special use of UNIONS?
Is boolean a datatype in c?