Code Golf: Code Golf: Difference between revisions

→‎{{header|C}}: puts() adds a newline character after the final “f”, printf() not.
m (C of L syntax requires Ada 12)
(→‎{{header|C}}: puts() adds a newline character after the final “f”, printf() not.)
Line 151:
The following answers assume compilation using gcc 11.3.0 on ubuntu 22.04, without using any special options and ignoring the warnings.
 
The shortest possible program (2628 bytes) to print the required string is:
<syntaxhighlight lang="c">main(){putsprintf("Code Golf");}</syntaxhighlight>
 
The size of the executable needed to run this is 15,960 bytes.
 
If the program itself cannot contain string or character literals, then the shortest program I've been able to come up with (4850 bytes) is:
 
<syntaxhighlight lang="c">a[]={0x65646f43,0x6c6f4720,102};main(){putsprintf(a);}</syntaxhighlight>
 
The size of the executable needed is now 15,992 bytes.
4

edits