Post History
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 ...
Answer
#2: Post edited
# Assign `int`s 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 `int`s which you can assign inside `main` anyway.
- ## Try changing the number value here, it works!
- <!-- language-all: lang-c -->
- i;main(){i=0;printf("%i",i);}
- [Try it online!][TIO-krp1hiei]
- [TIO-krp1hiei]: https://tio.run/##S9ZNzknMS/@vnJmXnFOakqpgU1ySkpmvl2H3P9M6NzEzT0OzOtPWwLqgKDOvJE1DSTVTSSdT07r2/38A "C (clang) – Try It Online"
- # Assign `int`s 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 `int`s which you can assign inside `main` anyway.
- ## Try changing the number value here, it works!
- <!-- language-all: lang-c -->
- i;main(){i=0;printf("%i",i);}
- [Try it online!][TIO-krp1hiei]
- [TIO-krp1hiei]: https://tio.run/##S9ZNzknMS/@vnJmXnFOakqpgU1ySkpmvl2H3P9M6NzEzT0OzOtPWwLqgKDOvJE1DSTVTSSdT07r2/38A "C (clang) – Try It Online"
#1: Initial revision
# Assign `int`s 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 `int`s which you can assign inside `main` anyway. ## Try changing the number value here, it works! <!-- language-all: lang-c --> i;main(){i=0;printf("%i",i);} [Try it online!][TIO-krp1hiei] [TIO-krp1hiei]: https://tio.run/##S9ZNzknMS/@vnJmXnFOakqpgU1ySkpmvl2H3P9M6NzEzT0OzOtPWwLqgKDOvJE1DSTVTSSdT07r2/38A "C (clang) – Try It Online"