Skip to content

Instantly share code, notes, and snippets.

@komamitsu
Created March 2, 2024 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komamitsu/0f821b31210b73c1f72e14b96e90ec72 to your computer and use it in GitHub Desktop.
Save komamitsu/0f821b31210b73c1f72e14b96e90ec72 to your computer and use it in GitHub Desktop.
"Hello, World!" without recursions or loop
#include <stdio.h>
#include <ucontext.h>
#define N 1000000
int main(){
int i = 0;
ucontext_t ctxt;
getcontext(&ctxt);
if (i++ < N) {
printf("Hello, World!\n");
setcontext(&ctxt);
}
}
@komamitsu
Copy link
Author

-D_XOPEN_SOURCE option may be needed.

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