Program without main
#include<stdio.h> #include<stdlib.h> vector() { printf("program without main function...\n"); f1(); f2(); printf("we are in vector function\n"); exit(0); } f1() { printf("we are in f1 function\n"); } f2() { printf("we are in f2 function\n"); }OutPut:
madan@madan-Lenovo-G570:~/madan$ vi without_main.c madan@madan-Lenovo-G570:~/madan$ cc -nostartfiles without_main.c /usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000400390 madan@madan-Lenovo-G570:~/madan$ ./a.out program without main function... we are in f1 function we are in f2 function we are in vector function