answersLogoWhite

0

C program without main functoin

Updated: 8/9/2023
User Avatar

Wiki User

13y ago

Best Answer

If we save our program with .c extention before compiling it, the compiler with automatically include the header files. for eg-

First we save our program with sum.c and then compile it. It will not show any error.

1. Compilation needs header files, not execution.

2. Very small example programs can be written without using any header file, eg:

/* mini.c */

extern void (const char *puts);

int main (void)

{

puts ("Hello, world");

return 0;

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

You need one, and only one, main function in every C program. This is the entry point following library initialization. There can be no C program without a main function, unless you want to replace the run-time library - not a good idea.

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

You can compile it without difficulty, but cannot link it into an executable (still you can link a library).

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

You can't. Somewhere there must be a main() method, which is the program entry point. It may be the case that the main method is in a separate file somewhere that is included as a reference.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

There are no output statements in C. Anyway, here is an example:

int main (void) { return 0; }

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

Not possible.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program without main functoin
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can you write a program without main in c?

Certainly, you can write a program without main, but you cannot build an executable from it, if that is okay with you.


Can a C program be written without main METHOD?

Every program requires an entry point. Main() provides the entry point in C.


How you create c program without semicolon?

int main () {}


Is c program works without main function?

yes a C program can work without a main() function. Though its not the normal C code that you would be writing on ur gcc or turbo C compiler. for example Linux Source code ... does not have a main() function : for details u can visit: http://samarthonweb.blogspot.com/2009/08/c-programe-with-no-main-function.html


How do you get Linux program error in void main in c?

This question cannot be answered without seeing the source program.


How do you display semi colon without using semi colon in a c program?

main() { if(printf("%c",59)) }


How do you write a programm in c plus plus without using function main?

I don't think its possible. Every C++ program must at least have the main function.


Can a C program be written without main?

Yes. Windows GUI application are the tipical examples, their execution starts with 'WinMain', not 'main'


Write a program in C without any functions?

It is not possible. In C, any program must have at least one function to be able to compile and execute properly: the function main()


What must every c program have?

A main function must be present in every C program.


Can we run a C program without main?

You might, with the help of your linker program (renaming external symbols and stuff like that), but it would be absolutely pointless.


Can you execute a C program without writing main anywhere in the program?

With special linker-options (platform-dependent) you might be able to create a program that has function 'Start' (for example), instead of 'main', but I don't see any reason in it.