Code Golf
With Literals
Zen C allows string literals to be evaluated as statements to print them to standard output. By appending the .. operator, the implicit trailing newline is suppressed, emitting exactly the 9 required characters.
fn main(){"Code Golf"..}
Length: 24 bytes.
Without Literals
This version assumes the compiled executable is renamed to Code Golf and executed via ./Code Golf. It uses the program's own execution path in argv[0], offsets the pointer by 2 to skip the ./ prefix, and uses the POSIX write function to emit exactly 9 bytes to stdout (file descriptor 1). Omitting the explicit declaration for write triggers a compiler warning but saves bytes.
fn main(argc:int,argv:char**){write(1,argv[0]+2,9)}
Length: 51 bytes.
Executable Size
A standard build produces an executable of around 17KB. However, when the binary is stripped and compiled using the Tiny C Compiler (TCC) backend, the footprint can be reduced to just 8.6KB.
Attribution: This is a community solution for the Rosetta Code task Code Golf in Zen C.
This article uses material from the Rosetta Code article Code Golf, which is released under the GNU Free Documentation License 1.3. A list of the original authors can be found in the page history.