Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


why we should use main in C

Answers were Sorted based on User's Feedback



why we should use main in C..

Answer / kiran

because the execution of the c program bvegins from main().
Each function is called directly or indirectly through main.

Is This Answer Correct ?    43 Yes 10 No

why we should use main in C..

Answer / barjinder singh

Because the execution of the c program begins from main().

Is This Answer Correct ?    12 Yes 1 No

why we should use main in C..

Answer / ratnesh

bcz all the predefine functions are called by main function so we use main in C

Is This Answer Correct ?    15 Yes 5 No

why we should use main in C..

Answer / 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

why we should use main in C..

Answer / narendra allam

We can write a Program without main() function in C-language.

There should be one entry point in the program, so we need a
function to satrt with. In linker scripts it is mentioned,
we can change it through -e option for 'ld' linker with gcc.

Is This Answer Correct ?    11 Yes 6 No

why we should use main in C..

Answer / narendra

because main() the c program starts from here

with out main()
we cant run a program

and also it is predefined function must use this

narendra from nist

Is This Answer Correct ?    3 Yes 3 No

why we should use main in C..

Answer / sureshg

No, we can execute a pgm without main also, see here sorry do this pgm in your system with gcc compiler,,,,,

#include<stdio.h>
int exit(int);
{
printf("hello welcome to my answer");
exit(0);
}

while u compile this pgm type
gcc -nostartfiles filename.c

Is This Answer Correct ?    0 Yes 0 No

why we should use main in C..

Answer / kiran

Naren u just amzing

Is This Answer Correct ?    2 Yes 3 No

why we should use main in C..

Answer / bhaskar jha

bcz each function called by main() function .without it, we
can't execute the program.

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More Delphi Interview Questions

I just bought Delphi. Where are the language and library reference manuals?

0 Answers  


How to convert numbers into roman numerals?

0 Answers   Intel,


what is Client launching ?

0 Answers  


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

0 Answers  


How to Access a grid's column or row by name ?

0 Answers  


How to Get the date of a file using Delphi?

0 Answers  


How to Use global values in our application ?

1 Answers  


What to have ready before you call Borland Developer Support?

0 Answers  


How many tables can be connected with joins in oracle at a time?

0 Answers  


What databases can be used with dbExpress?

1 Answers  


How to Set break on exception in Delphi 4?

0 Answers   Accenture,


How is the memory used within an object in delphi?

0 Answers  


Categories