Created
October 19, 2018 14:46
-
-
Save t0mdicks0n/feac314595d25d78eb5c4f712ef93c6d to your computer and use it in GitHub Desktop.
Run with: `gcc -o quine quine.c && ./quine `
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int c; | |
// Open the source code as a file buffer | |
FILE* file = fopen("./quine.c", "r"); | |
if (file) { | |
// Iterate over the characters in the file | |
while ((c = getc(file)) != EOF) | |
putchar(c); | |
// Close the file buffer | |
fclose(file); | |
// Print a new line to the console | |
printf("\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment