News for hackers. Stuff that matters.
Re:Show HN: Runc – Compile and run C in one command by skolskoly on Tuesday June 23, 2020 @11:26AM (#23615167)
Quick and ugly alternative is chmod+x and add something like this to the top of your file:

  //$(which gcc) $0 -o a.out; ./a.out $@; rm a.out; exit
Re:Show HN: Runc – Compile and run C in one command by alcover on Tuesday June 23, 2020 @11:43AM (#23615439)
Clever polyglot file!

Does not work in the spirit of my script though, since you would still need to add headers and main():

  //$(which gcc) $0 -o a.out; ./a.out $@; rm a.out; exit
  int i = 10;
  printf ("%d\n", i);
./snip.c:3:9: error: expected declaration specifiers or ‘...’ before string constant printf ("%d\n", i);
Re:Show HN: Runc – Compile and run C in one command by solvorn on Tuesday June 23, 2020 @12:23PM (#23616092)
This. My first thought was there is a UNIXy way to do this already.