[圖解C] Example 725: Generic Pointer, void*

// Example 725: Generic Pointer, void*
// int*, float*, char*, double* can be exchange by void*
// using (void*) to convert certain type into generic type

#include <stdio.h>
#include <stdlib.h>

int main()
{
    // convert 100 into any type
    void *ptr = (void*)100;
   
    // content of pointer dep on pointer
    printf("Address: %p\n", ptr);
    printf("Integer: %d\n", ptr);
    printf("Character: %c\n", ptr);
   
    system("pause");
    return 0;
}