Write a example of void pointer.

C Programming Language Pointer in C Language (Article) Pointer in C Language (Program)

1186

Program:

#include <stdio.h>
int main()
{
	int a=5;
	double b=3.1415;
	void *vp;
	vp=&a;
	printf("\n a= %d", *((int *)vp));
	vp=&b;
	printf("\n a= %d", *((double *)vp));
	return 0;
} 

Output:

 a= 5
 a= -1065151889

Explanation:

None

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.