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 |
write a function for strtok()??
what is the code for getting the output as * ** ***
Efficient data structure for store/search list of 1000 records a)array b)double linked list c)circular queue d)hash table
how to write a cprogram yo get output in the form * *** ***** ******* ********* ******* ***** *** *
What is the difference between far and near in c?
what are advantages of U D F?
How to find the given no is odd or even without checking of any condition and loops. (Hint: Using array)
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
how can i get output the following... 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 and 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 plz plz...
how can i print "hello"
Can we initialize extern variable in c?
How to reverse a linked list
1 Answers Aricent, Fidelity, IBM, TCS,