Skip to content

Instantly share code, notes, and snippets.

@eliminmax
Created January 30, 2026 14:39
Show Gist options
  • Select an option

  • Save eliminmax/95ece23b3305e4d9124572e01b3e9ea1 to your computer and use it in GitHub Desktop.

Select an option

Save eliminmax/95ece23b3305e4d9124572e01b3e9ea1 to your computer and use it in GitHub Desktop.
/*
* SPDX-FileCopyrightText: 2026 Eli Array Minkoff
*
* SPDX-License-Identifier: 0BSD
*/
// trivial C23 quine using #embed
//
// probably should be considered cheating
#include <stdio.h>
static const char SOURCE[] = {
#embed __FILE__
, 0
};
int main() {
fputs(SOURCE, stdout);
}
@eliminmax
Copy link
Author

Tested with clang-20.

Compilation command:
clang -std=c23 -Wall -Wextra -Wpedantic hash_embed_quine.c -o hash_embed_quine

Output is identical to source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment