Posts by Lundin
For this to work, I think we need to rule out all start-up code (the C runtime) but also the register maps. So I think answers should be a void main (void){ ... } (or equivalent) function solution ...
C (gcc), 126 129 bytes N=9999;f(n){int p[N],i,j,P;memset(p,1,N);for(i=P=2;i*i<N;i++)if(p[i]){for(j=i*i;j<N;j+=i)p[j]=0;i-P>=n?j=N:(P=i);}e:return P;} Try it online! This is an integer...
If you actually use the library, sure, I guess. How you are going to get it running on online compilers, I have no idea. It's very uninteresting for others to view some code using a custom library ...
The C (gcc) implies extensions - it will only work with that specific compiler under it's default setting GNU17 (equivalent to -std=gnu17), which is mostly a superset of standard C. This also inclu...
C (gcc), 358 bytes static inline _Noreturn float f(union u);extern _Thread_local _Complex long double*restrict B;main(void){_Atomic register enum {A};typedef _Alignas(unsigned char)struct S;_Sta...
C (gcc), 45, 42 bytes t[9999];f(s,a)int*a;{for(;s;)t[a[--s]]++;} Try it online! Assumptions: Passing the array size to a function can be used as a means to deal with empty arrays (not s...
C (gcc), 30 bytes main(){puts("Hello, World!");} Try it online! This is using GNU C extensions. GNU C allows main() over int main(), ss well as using puts without including stdio.h.
C (gcc), 88 bytes char a[53]={91},*p=a+1,i;f(n,d){for(;i<50;)p[i++]=1.*n/d<=i/50.?45:124;p[i]=93;puts(a);} Try it online! There's two approaches to this in C that I came up with - eith...
I was thinking the same thing. Maybe instead there should be one category for code golf and leave the main Q&A is for other types of challenges and puzzles?
Function parameters should not be allowed to be used in place of a return value. Reasons: Terms like return value and function result are explicitly specified as a specific, formal language i...
- ← Previous
- 1
- 2
- 3
- Next →