Pointer generic in C.

 

01  #include<stdio.h>
02
03 int main()
04 {
05
06 int a=10;
07 float f=3.3;
08
09 void *ptr; // generic pointer
10
11 ptr=&a; // pointer points to integer variable
12
13 printf("Value of a : %d nn",a);
14
15 ptr=&f; // pointer points to float variable
16
17 printf("Value of f : %.2f nn",f);
18
19 return 0;
20 }
 
 OUTPUT :

Value of a : 10

Value of f : 3.30

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.