Questions tagged [c]
This challenge is related to the C language. Note that challenges that require the answers to be in a specific language are generally discouraged.
66 questions
7
votes
1
answer
335
views
Automated C Golfer
Introduction
Is it possible to create a program to automatically golf C code while maintaining the original functionality? That's what I hope to find out in this question.
Challenge
The input consists ...
1
vote
0
answers
89
views
Write a piece of Quine code that can be excuted by both C and Python [duplicate]
Write a piece of code that is compatible with both C and Python compilers/interpreters, which can output its own source code.
Quine is quite easy, but how about this double language version?
Hint:
To ...
7
votes
8
answers
627
views
Curry a C function pointer [closed]
Objective
Given a type signature of a C function pointer represented as a string, output the (fully) curried version of it, also as a string.
I/O format
It is assumed that:
There is at least one ...
7
votes
2
answers
345
views
Convert maximum values to bit widths
Background
The newest version of the C standard, C23, adds preprocessor macros like INT_WIDTH, ULONG_WIDTH, and ...
6
votes
4
answers
2k
views
Shortest C code to display argv in-order
I recently tried to produce the shortest C code possible to display all its command line arguments (which are stored in argv).
I ended with a relatively small piece of code, and I was wondering if ...
-2
votes
1
answer
134
views
PHP+C polyglot solution to mixed types
Some built-in functions in PHP return mixed types, like file_get_contents that returns both string or ...
1
vote
1
answer
211
views
Start a program so that /proc/self/cmdline contains a binary representation of the input number
I am sorry for the very long description. But i think some information of how /proc/self/cmdline works and how it can be used to get a integer input was necessary.
...
13
votes
2
answers
1k
views
Can Bitshift Variations in C Minor be compressed down to less than 185 characters?
Bitshift Variations in C Minor by Robert Miles is a Code Golf music piece written in C (with some additional bash commands). It was originally presented in a 2016 Computerphile video Code Golf & ...
6
votes
1
answer
255
views
Need some feedback with PHP+C polyglot code and class/struct properties [closed]
If you consider the following PHP+C polyglot snippet, there is a problem regarding class property access in the printf call:
...
5
votes
1
answer
775
views
Help me golf this C program checking for string patterns in a sorted hand of cards
I could not think of a better title.
This is a tips question. I'm asking for tips on golfing my code.
I recently took part in a code golf competition in C. The competition ended and I lost. The ...
6
votes
1
answer
2k
views
fastest matrix multiplication on x86
This challenge requires integration with C, so you can stop reading if you're not interested.
Matrix multiplication is a simple operation, but the performance depends a lot on how efficiently the code ...
9
votes
5
answers
395
views
Convert the type modifiers from prefix to C-fix
Given a base type T, this can be augmented with * or [], each meaning pointer and array. For ...
4
votes
0
answers
182
views
Tips for golfing in Objective C
Although on codingame.com, Objective C and C are two of the best golfing languages there, so I would like to know some of the best golfing methods (although I am a python person, I am currently trying ...
11
votes
1
answer
468
views
Tips for golfing a fibonacci sequence generator
One day in July 2020, I made the following C program:
...
25
votes
12
answers
3k
views
Decide a C integer literal
Objective
Given an ASCII string, decide whether it is a valid C integer literal.
C integer literal
A C integer literal consists of:
One of:
0 followed by zero or ...