Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*============================================================================
- ----------------------------------------------------------------------------
- weird.c - Void pointer versatility...
- (c) Damion 'Phr0z3n.Dev' Tapper, 2013.
- Email: Phr0z3n.Dev@Gmail.com
- NOTE: void* - The 'pawn' of C Programming.
- ----------------------------------------------------------------------------
- ============================================================================*/
- #define USE_SEC_API /* Comment this line if you do not have the secure libraries. */
- #include <stdio.h>
- void* retVal(void *); /* This is 'not so' weird... */
- int main(void)
- {
- int *a;
- a = retVal((void *)2); /* ...but this is... */
- #ifdef USE_SEC_API
- printf_s("%d", a); /* The secure printf function (good programming practice). */
- #else
- /* If you are lacking the secure libraries. */
- printf("%d", a);
- #endif
- return 0;
- }
- void* retVal(void *nada) /* ...because of this. */
- {
- return (int *)(2 * (int)nada); /* Now this is really, really weird. */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement