Void Pointer in C.

 #include<stdio.h>

#include<conio.h>

int main()
{
    int a = 345;
    float b = 6.9;
    void *ptr;
    ptr = &b;
    printf("The value of b is %f\n", *((float *)ptr));
    ptr = &a;
    printf("The value of a is %d\n", *((int *)ptr));
    return 0;
}

OUTPUT:
The value of b is 6.900000 The value of a is 345

Comments

Post a Comment

Popular posts from this blog

C Program using continue statement

C program of WHILE Loop

NULL Pointer in C.

C Program using DO WHILE loop

C Program using SWITCH statement

New Animated Login or signup page made by HTML, CSS and JavaScript.

C Program to print multiplication table of any number.

C Language Travel Agency Manager Exercise.

STRUCTURE IN C PROGRAMMING.