Void Pointer

There are some examples in below

It will help you to understand how void pointer works

void use_int(void *r) {
int a;
a = * (int *) r;
printf(“As an integer, you are %d years old.\n”, a);
}

void use_float(void *s) {
float *b;
b = (float *) s;
printf(“As a float, you are %f years old.\n”, *b);
}

This entry was posted in open-source. Bookmark the permalink.

Leave a comment