belongs to collection: Pointers and dynamic allocation memory in C
In this example, we will learn what is void pointer in C and how we can use void pointer in our C code.
For example, if you want to store the address of the character, the pointer should be a pointer to the character.
#include <stdio.h> int main(int argc, char *argv[]) { void *pvData = NULL; //void pointer int *iData = NULL;// integer pointer char *cData = NULL;//character pointer float *fData = NULL;//float pointer //size of void pointer printf("size of void pointer = %d\n\n",sizeof(pvData)); //size of void pointer printf("size of integer pointer = %d\n\n",sizeof(iData)); //size of void pointer printf("size of character pointer = %d\n\n",sizeof(cData)); //size of void pointer printf("size of float pointer = %d\n\n",sizeof(fData)); return 0;
Output: On a 32-bit machine
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Output: On a 32-bit machine