116. Write a program to type cast one pointer into another pointer using void?

#include<iostream.h>
#include<conio.h>
void main()
{
                float *pf,f=10.1;
                pf=&f;
                int *pi;
                void *vp;
                clrscr();
                vp=pf;
                pi=(int *)vp;
                cout<<"Value of Pf = "<<(unsigned)pf<<endl;
                cout<<"Value of Pi = "<<(unsigned)pi<<endl;
                getch();
}

116.PNG

Advertisements

Comments are closed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: