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 |
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream
4. main() { int c=- -2; printf("c=%d",c); }
What is assignment operator?
how to get the starting address of file stored in harddisk through 'C'program.
how to construct a simulator keeping the logical boolean gates in c
Table of Sudoku n*n
What is the g value paradox?
Explain the use of 'auto' keyword
main() { int i=5; printf("%d%d%d%d",i++,i--,i); }
What is pointer in c?
Why cann't whole array can be passed to function as value.
what is the role you expect in software industry?