why the execution starts from main function

Answer Posted / ravi joshi

As many of them have answered here, main is a special
function in C/C++ programs. The compiler does not care if
you have defined main or not, but linker does. If linker
finds main defined in the objects being linked, then the
address of main function is placed at the top of execution
stack. And automatically when loader loads the
program/process, the main function gets loaded at the top of
execution stack, and system starts execution using
__crtmain() which internally calls main() of the program/process

Is This Answer Correct ?    16 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the HiFi’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the HiFi’s Restaurant offers the following breakfast menu: Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast $2.95 Fruit Basket $3.45 Cereal $0.70 Coffee $1.50 Tea $1.80

2548


What is use of bit field?

762


What is the use of getch ()?

620


Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant

658


What are different types of operators?

590






In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

756


How can I write functions that take a variable number of arguments?

618


In c language can we compile a program without main() function?

567


Explain 'far' and 'near' pointers in c.

695


What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?

736


The file stdio.h, what does it contain?

657


using only #include and #include Write a program in C that will read an input from the user and print it back to the user if it is a palindrome. The string ends when it encounters a whitespace. The input string is at most 30 characters. Assume the string has no spaces and distinguish between and lowercase. So madam is a palindrome, but MadAm is not a palindrome. Use scanf and %s to read the string. Sample Test: Enter a string: madam madam is a palindrome. Enter a string: 09023 09023 is not a palindrome.

1302


Does c have function or method?

582


What does static variable mean in c?

641


How are pointers declared in c?

590