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
using only #include
What is sizeof return in c?
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
What is p in text message?
What does struct node * mean?
What is 2c dna?
What are structural members?
What is an operator?
How can you find out how much memory is available?
When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?
Explain what are preprocessor directives?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
Why isnt there a numbered, multi-level break statement to break out
What is the difference between procedural and declarative language?
Is it better to bitshift a value than to multiply by 2?