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 Get a list of the available drives on a system?

1248


Do I have to understand object-oriented programming to use Delphi?

542


How to insert an InterBase BLOb in Delphi using LoadFromFile? 2

3781


How to Change the location of the object repository ?

1383


How to Create a palette with more than one entry ?

1469






How to Calculatea point using angles and distance?

1489


what are the different Dataset event handlers?

1222


What is a good BDE Alternative?

1487


How to Retrieving the program that is associated with a given extension?

1258


How to Use Stored Procedures ?

1320


How to DetermineDrive Type ?

1433


How to Switch between different data sources?

1509


How to Create new constructors?

1368


How to Detect if the system time has been changed ?

1321


How to Remove drives listed in a TDriveComboBox ?

1468