+ 1

How C programs can be run without main() function ?

Example C code which works perfectly : #include <stdio.h> extern void _exit(register int); int _start() { printf(“Hello World\n”); _exit(0); }

20th Jul 2017, 6:57 PM
Soumyadeep Debnath
Soumyadeep Debnath - avatar
2 Answers
+ 2
Interesting. According to this: https://stackoverflow.com/questions/22812682/can-a-c-program-run-without-main-function The code you showed would still be using a main function. Although, according to this: https://stackoverflow.com/questions/3666540/c-program-without-a-main-function "_start function is the entry point of a C program which makes a call to main()." So _start is likely another special function.
20th Jul 2017, 7:49 PM
Rrestoring faith
Rrestoring faith - avatar