r/programming • u/iximiuz • Jul 25 '26
Writing a (valid) C program without main()
https://labs.iximiuz.com/tutorials/c-program-without-main-a1eea557
193
Upvotes
r/programming • u/iximiuz • Jul 25 '26
View all comments
12
u/BCMM Jul 25 '26 edited Jul 25 '26
I'd accept "working" program, but I'll quibble over "valid".
Officially, whatever happens before
main()is between God and the standard library, and a C program isn't supposed to know about it._startis a platform-specific quirk of how executables work, not a part of the C language, so this is more of a demonstration of a non-valid C program that you can nevertheless trick a C compiler in to processing.