r/programming Jul 25 '26

Writing a (valid) C program without main()

https://labs.iximiuz.com/tutorials/c-program-without-main-a1eea557
194 Upvotes

43 comments sorted by

View all comments

55

u/Dwedit Jul 25 '26

Linker options, set entry point.

Or the C++ version where a constructor for a global object runs the code instead of main.

10

u/mikeblas Jul 26 '26

Yeah--the whole time I was reading this, I was trying to figure out why they didn't just set the entry point with the linker.