Can we write a program without main() function?
Answers were Sorted based on User's Feedback
Answer / rahul
no we can't write a program with out main function, this
function is the main function which usually help OS to kill
the process that has executed, like in JAVA main() is used
as a thread whose wqork is to kill the executed process and
mark those as GC( Garbage collection)
Is This Answer Correct ? | 14 Yes | 9 No |
Answer / rahul
no we can write a program with out main function, this
function is the main function which usually help OS to kill
the process that has executed, like in JAVA main() is used
as a thread whose wqork is to kill the executed process and
mark those as GC( Garbage collection)
Is This Answer Correct ? | 10 Yes | 7 No |
Answer / vignesh1988i
as for i know in C , we cant write a program wit out main()..
since whatever function we write (user defining functions).
it will start executing the statements only from the
main().... so only we will say tht FIRST EXECUTABLE FUNCTION
IS THE MAIN() FUNCTION.........
Is This Answer Correct ? | 4 Yes | 3 No |
Answer / gandhi gorantla
Yes we can,try it
class d
{
static{
System.exit(0);
}
}
it compiles and executes without error in java.
Is This Answer Correct ? | 3 Yes | 2 No |
Answer / infestant mongrel
@Rahul
In java, the job of killing the threads who have done their job (and garbage collection) is done by the java runtime environment. The main thread may even itself come to an end before all its child threads have completed their execution.
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / samarth
yes, we can write C programs , without main() functions.
though they are not the kind of programs we use in everyday
life .For example linux kernel source code do not have any
main() function.
for details u can visit :
http://samarthonweb.blogspot.com/2009/08/c-programe-with-no-main-function.html
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / vaibhav
no because every c prog. can compile from main function.
but when we write a code for creating a header file, we
cant use main function.
Is This Answer Correct ? | 2 Yes | 4 No |
Answer / revathipawar
no we cant write bcoz main() tells to the processor that it
is starting of the c programming
Is This Answer Correct ? | 2 Yes | 4 No |
Answer / rajkumar
I think its possiblle through macros ....like this
#define main() start
start
{
printf("Hai");
}
Is This Answer Correct ? | 8 Yes | 11 No |
Is c object oriented?
What is a node in c?
what does ‘Bus Error’ mean?
How would you sort a linked list?
WHAT IS LOW LEVEL LANGUAGE?
When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.
Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings
what will be the output of this program? #include<stdio.h> #define cube(x) x*x*x void main() { int i,j=5; i=cube(j+3); printf("i=%d",i); }
What is function prototype in c language?
Is exit(status) truly equivalent to returning the same status from main?
to find the program of matrix multiplication using arrays
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE