why we should use main in C

Answer Posted / naendra allam

Asume abc.c is the program
--------\abc.c\---------
#include <stdio.h>
#include <stdlib.h>

int naren()
{
printf("Hi--- Ther is no main() here.\n");
exit(EXIT_SUCCESS); //Not supposed to use 'return 0;'
}
-----------------------
//compilation with GCC
$gcc -c abc.c

---> which generates abc.o

$ld --dynamic-linker /lib/ld-linux-so.2 -oabc abc.o -enaren
-lc

---> which generates executable 'abc'

$./abc
Hi--- Ther is no main() here.

--->you ran the program.

ALL THE BEST

Narendra Allam
IVTL INFOVIEW

Is This Answer Correct ?    12 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to Use the WinApi GetObject to get a bitmap?

2404


what are the files that need to be included with applications using MSACCESS?

1188


Define PRIMARYLANGID(), SUBLANGID(), and MAKELANGID() macros?

2198


How to Create Non-Visual Components Without Icons ?

1327


what is the use of TSocketDispatcher?

1620






How to create indexes with the TTable create function?

1277


How to Convert ASCII files to Paradox tables?

1530


How to Get the current line number of a TMemo?

1831


How to Map a DLL into another process ?

1176


How to Place a grid in edit mode programatically?

1441


How SQL Links determines if an MSSQL table can refreshed?

1330


How to Finddistance between two points?

1486


How to Migrate a project from Delphi 1 or 2 to Delphi 3 ?

1324


How to Get current record from a TDBGrid ?

2672


How to Move a form by clicking in its client area ?

1402