Comments on Tips for golfing in C
Parent
Tips for golfing in C
+3
−0
C is a language I use most apart from Python and as someone who likes code golf challenges, what tips are there to golf in C?
+2
−0
Use pointer arithmetic and `\0 …
5y ago
+1
−0
For the sake of code golf, you …
5y ago
+1
−0
Assign `int`s before `main(){} …
5y ago
+0
−0
Abuse (as few) libraries (as p …
5y ago
Post
+1
−0
Assign ints before main(){}
This is a combination of 2 golfing tricks. It's possible to write a program as just main(){}, though it will send a warning, not an error though, so it's still safe to run.
A cool trick with using this is assigning values meant to be ints which you can assign inside main anyway.
Try changing the number value here, it works!
i;main(){i=0;printf("%i",i);}

0 comment threads