Code Golf: Code Golf: Difference between revisions
Content added Content deleted
m (BASIC256 moved to the BASIC section.) |
(Added C) |
||
Line 127: | Line 127: | ||
Without quoted literals: |
Without quoted literals: |
||
<syntaxhighlight lang="bqn">•Out@+111-44‿0‿11‿10‿79‿40‿0‿3‿9</syntaxhighlight> |
<syntaxhighlight lang="bqn">•Out@+111-44‿0‿11‿10‿79‿40‿0‿3‿9</syntaxhighlight> |
||
=={{header|C}}== |
|||
The following answers assume compilation using gcc 11.3.0 on ubuntu 22.04, without using any special options and ignoring the warnings that: |
|||
1. The default return type of 'main' is 'int'; and |
|||
2. 'printf' is being implicitly declared (i.e. no explicit #include <stdio.h>). |
|||
The shortest possible program (28 bytes) to print the required string is: |
|||
<syntaxhighlight lang="c">main(){printf("Code Golf");}</syntaxhighlight> |
|||
The size of the executable needed to run this is 15,968 bytes. |
|||
If the program itself cannot contain string or character literals, then the shortest program I've been able to come up with (82 bytes) is: |
|||
<syntaxhighlight lang="c">main(){int c[]={37,9,2,3,70,33,9,10,0};for(int i=0;i<9;++i)printf("%c",c[i]^102);}</syntaxhighlight> |
|||
The size of the executable needed is now 16,016 bytes. |
|||
Output in both cases: |
|||
<pre> |
|||
Code Golf |
|||
</pre> |
|||
=={{header|dc}}== |
=={{header|dc}}== |