Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 2325

Code-golf is a competition to solve a particular problem in the fewest bytes of source code.

21 votes

Produce the number 2014 without any numbers in your source code

C (gcc), 31 bytes main(){printf("%o",' b'/'\b');} Try it online! C (gcc), 32 bytes main(){printf("%x%o",' ','\f');} Try it online! C (gcc), 30 bytes main(){printf("%x",' j'^'~');} Try it online! …
fredoverflow's user avatar
  • 2,709
12 votes

Convert C header names to C++ header names

Java 8 — 25 characters h->"c"+h.replace(".h","")
fredoverflow's user avatar
  • 2,709
10 votes

Convert C header names to C++ header names

Haskell — 23 characters ('c':).takeWhile(/='.') Haskell — 16 characters, as suggested by nimi ('c':).init.init
fredoverflow's user avatar
  • 2,709
27 votes
55 answers
4k views

Convert C header names to C++ header names

In the C standard library, header names end with a .h suffix: stdio.h In C++, those header names are available in an alternative form, with a c prefix instead: cstdio Write a function that conve …
fredoverflow's user avatar
  • 2,709