/** * voidstuff.c * Some explorations of void pointers. */ #include #define PRINT_AND_EVAL(STATEMENT) \ do { printf ("%s;\n", #STATEMENT); STATEMENT; } while (0) #define PRINT_POINTER(PTR) \ printf (" // %s = %p (%u)\n", #PTR, (void *) PTR, (unsigned int) PTR); int main () { int i; char ch; void *ptr; PRINT_AND_EVAL(ptr = &i); PRINT_POINTER(ptr); PRINT_AND_EVAL(++ptr); PRINT_POINTER(ptr); PRINT_AND_EVAL(ptr = &ch); PRINT_POINTER(ptr); PRINT_AND_EVAL(++ptr); PRINT_POINTER(ptr); } // main