English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

c language question

2006-07-09 17:02:16 · 6 answers · asked by engg 1 in Computers & Internet Programming & Design

6 answers

just as you have to turn the key to start the car before you can drive it, your program has to enter a main() to start executing the rest of the code

2006-07-09 18:02:04 · answer #1 · answered by vikram 1 · 0 0

the answers of others is good also I would like to add that you can pass parameters to the main function such as c:\>dir /p the dir is the program and the /p is the parametere which the program will take and start work upon it. other example
c:\> format a: /s here the a: and /s are both parameters which user pass them to the program in the start of the program these parameters ahve to be passed to function this function have to be the start of the program this function is the main() function.

Thak you

2006-07-10 05:23:15 · answer #2 · answered by amr_osama 3 · 0 0

The compilers is designed somehow, that main() is the first function to be run...and watever function which is called inside
main() will be executed ..

for instance

main()
{ .....
thisFunction(anyValue);/* compiler will look for the body of thisFunction() in the program..it passes the values and do the function. Once execution of thisFunction is done, it passes the return value to the place it was called..... */
}

thisFunction(anyValue){...}
anotherFunction() {....}/*this function wont be executed since is not called in main() or in anyother function*/


so... if complier can't find the main() function, it throws error..

(srry if syntaxes r wrong... its a long tme i didnt do C)

2006-07-10 05:29:25 · answer #3 · answered by zoha 3 · 0 0

because the main() gets called when the program runs which will then run everything inside the main().
But it has been a while since i have programmed in c so here is a link that should explain everything

2006-07-10 00:06:12 · answer #4 · answered by steven 4 · 0 0

It is just like a man without brain

2006-07-10 06:37:49 · answer #5 · answered by india_kakinada 2 · 0 0

I think, it is c rules like ansi or posix.

2006-07-10 01:02:23 · answer #6 · answered by stonemason_2 1 · 0 0

fedest.com, questions and answers