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 |
C program to perform stack operation using singly linked list
int x=5; printf("%d%d%d",x,x<<2,x>>2);
What is the difference between mpi and openmp?
What is the usage of the pointer in c?
How can you find out how much memory is available?
disadvantages of realloc ?
what is the difference between %d and %*d in c languaga?
what will be maximum number of comparisons when number of elements are given?
Write a C program to find the smallest of three integers, without using any of the comparision operators.
What is the use of getchar functions?
WAP to find that given no is small or capital
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?