why does the execution of a c++ program start with main()???

Answer Posted / ajaykumar(me-tu)

I agree with above answer(given by Sujith). It is not
necessary the execution of program always start with main
function. Using pragma startup directive we execute any
function before executing main function. Here we give one
example in c language.

#include<stdio.h>

void print()
{
printf("\nThis is print function");
}
#pragma startup print
void main()
{
printf("\nThis is main function");
}

Output:
This is print function
This is main function

Is This Answer Correct ?    9 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does an stl file work?

646


What two types of containers does the stl provide?

566


Q1. A. What is unary operator? List out the different operators involved in the unary operator. B. What is an adjust field format flag? Q2. A. Distinguish between a # include and #define. B. Can a list of string be stored within a two dimensional array? Q3. A.Explain how a pointer to function can be declared in C++? B.List the merits and demerits of declaring a nested class in C++? Q4. A. What are the syntactic rules to be avoid ambiguity in multiple inheritence? B. Explain the operation of overloading of an assignment operator. Q5. A. Explain how the virtual base class is different from the conventional base classes of the opps. B. Explain how an exception handler is defined and invoked in a Program. Q6. A. What is a binary file? List the merits and demerits of the binary file usagein C++. B. Write short notes on Text Manipulation Routines. C. Write bites in Turbo c++ Header (“Include”) Files.

2307


What is a standard template library (stl)? What are the various types of stl containers?

667


how can u do connectivity in c++ language? plz send me connectivity code in c++ ?

1889






When did c++ add stl?

727


draw a flowchart that accepts two numbers and checks if the first is divisible by the second.

2856


What is stl stack?

658


What is a list in c++ stl?

689


How do I convert a stl file?

562


What is stl in oop?

673


Is stl part of c++ standard?

637


Is there any error below, its a code to delete all entires from a map #include #include iostream.h int main() { int i =0; map TestMap; while(i<3) { TesMap.insert(TestMap::value_type(i,Test)); i++; } typedef map :: iterator mapIter =TestMap.begin(); if(mapIter!=TestMap.end()) { TestMap.erase(mapItrer); ++mapIter; } return 0; }

1889


write a program that will accept a number and print.its equivalent in words the maximum input number is 9999

2496


What is stl language?

670