answersLogoWhite

0


Best Answer

Because we usually don't call it from the program, but if we do, you should have a prototype:

int main (int argc, char **argv);

int foobar (const char *progname)

{

char *param[2];

...

param[0]= progname;

param[1]= "help";

main (2, param);

...

}

int main (int argc, char **argv)

{

...

foobar (argv[0]);

...

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why doesn't the main function need a prototype statement?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

When can a function prototype be omitted?

when we write definition of a function i.e; body of a function above main() function, then the function prototype be omitted. -Ramashankar Nayak,M.C.A,Pondicherry University


When is a function executed and where should a function prototype and function definition appear in a source program?

If you want to use prototype it has to be declared before main(). If you have a function of type double with one argument of type int (with name arg), and the function name is func, then we have:#include ...double func(int arg);...int main(...){...return 0;}...double func(int arg){...}


What are its program components?

the main() function,the#include Directive, the variable definition. function prototype, program statements, the function definition,program comments and braces are the components of program in C++


Can you write a program without defining the function prototype?

Sure: int main (void) { puts ("Hello, world"); return 0; }


Is the main advantage of a prototype is users can work with the system before it is completed?

Essentially, yes. In computer programming terms, a prototype provides the compiler with a function's signature, making it possible for code to invoke that function even if the function definition hasn't yet been encountered by the compiler. In other words, it is not necessary to know what the function does in order to call it; the prototype provides all the information required to invoke the function. Outside of computing, a prototype is a working model of a system that developers can use to demonstrate the system's functionality and to work upon improvements to the design before going into full production.


Where do turbo c programs begin excution?

At the first statement of function main.


Where does main returns garbage value?

With return without value, or by dropping off the last statement in the function.


Where does c language program begin execution?

The execution of the program starts with function main, wherever it is in the source.


Why we use function prototyping in c language?

You could just define the whole function before it is called, like this:void do_nothing(){}main(){do_nothing();}but if you define the function after it is called, the compiler will arrive at the function's calling before its actual definition. If you prototype your function earlier in the code than the function's call, the compiler will look for the function first.Hope I was able to help.


What is a prototype within a program?

Prototyping is done (at least in C/C++) to declare a function and tell the compiler how to use it before the int main(void) part of the program is run. The function is declared after main and is usually done as a style thing. example int function(int); int main(void) { int anumber = 1; x = function(anumber); return 0; } int function(int number) { //do something return number; } et cetera et cetera...


What is the main function of that organization?

to pump blood throughout the body and keep you alive.


What is the meaning of statement missing in function main in c language?

Every C program must have a function, named main(), which is where the program starts execution. If there is no function main(), the computer does not know where to start running the program. The function main() must also do something; if it is just empty, some smarter compilers will note that there is nothing for the program to do, and will give this sort of error message to indicate that you forgot to tell the program what to do.