Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is void pointer?

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


Please Help Members By Posting Answers For Below Questions

Explain about C function prototype?

1086


Explain how do you list a file’s date and time?

1037


Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

1125


What is the benefit of using #define to declare a constant?

1090


all c language question

2434


What is c system32 taskhostw exe?

1024


Are local variables initialized to zero by default in c?

1051


write a program to print data of 5 five students with structures?

2046


What is the difference between c &c++?

1156


Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?

1250


Is multithreading possible in c?

1011


a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor

1092


What is class and object in c?

1119


Once I have used freopen, how can I get the original stdout (or stdin) back?

1075


write a program to find the given number is prime or not

4761