Computer Science, asked by Anmolmann, 1 year ago

What is the function that always exists and is not first calling function?

Answers

Answered by rockman968
1

Note -- the below code compiles in a C++ compiler, but throws error in C as pointed out in the comment. So this answer is applicable to C++ programs.

Normally the compiler always starts main first, but some compiler specific extensions exist, like #pragma. But we can execute a function before main by placing it as an initializer for a global variable. For example:

#include <stdio.h>

static int init(void)

Answered by sailorking
0

The function which is compulsory to exist is the main function, from where the program starts it's execution. But some times it happens that a function with the type "static" is declared is executed first before the main function, as a static function is independent. At that instance of time, it can be said that main function is the function that always exists and is not first calling function.

This concept of this kind of function is applicable for the programs written in C and C++, programming languages.

Similar questions