Skip to content

Instantly share code, notes, and snippets.

@seungwon0
Created April 2, 2011 08:36
Show Gist options
  • Save seungwon0/899335 to your computer and use it in GitHub Desktop.
Save seungwon0/899335 to your computer and use it in GitHub Desktop.
Print the source code of itself
/*
* print-source.c - Print the source code of itself
*
* print-source prints the source of itself without using file I/O.
*
* http://www.indidev.net/forum/viewtopic.php?p=150
*
* Seungwon Jeong <[email protected]>
*
* Copyright (C) 2011 by Seungwon Jeong
*/
#define P(x) int main(void) { puts(#x); puts("P(" #x ")"); return 0; }
P(#define P(x) int main(void) { puts(#x); puts("P(" #x ")"); return 0; })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment