ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Can we write a program without main() function?
 Question Submitted By :: Sivavendra
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Can we write a program without main() function?
Answer
# 1
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 ?    1 Yes 0 No
Rahul
 
  Re: Can we write a program without main() function?
Answer
# 2
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 ?    5 Yes 1 No
Rahul
 
 
 
  Re: Can we write a program without main() function?
Answer
# 3
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 ?    1 Yes 0 No
Vignesh1988i
 
  Re: Can we write a program without main() function?
Answer
# 4
I think its possiblle through macros ....like this

 #define main() start
  start
{
printf("Hai");
}
 
Is This Answer Correct ?    1 Yes 4 No
Rajkumar
 
  Re: Can we write a program without main() function?
Answer
# 5
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 ?    0 Yes 0 No
Vaibhav
 
  Re: Can we write a program without main() function?
Answer
# 6
no we cant write bcoz main() tells to the processor that it 
is starting of the c programming
 
Is This Answer Correct ?    0 Yes 1 No
Revathipawar
 
  Re: Can we write a program without main() function?
Answer
# 7
@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 ?    0 Yes 0 No
Infestant Mongrel
 
  Re: Can we write a program without main() function?
Answer
# 8
Yes we can,try it
class d
{
static{
System.exit(0);
}
}
it compiles and executes without error in java.
 
Is This Answer Correct ?    0 Yes 1 No
Gandhi Gorantla
 
  Re: Can we write a program without main() function?
Answer
# 9
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 ?    0 Yes 0 No
Samarth
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
what will happen if you free a pointer twice after allocating memory dynamically ? Novell2
While(1) { } when this loop get terminate is it a infinite loop?  4
#include<stdio.h> main() { char s1[]="Ramco"; char s2[]="Systems"; s1=s2; printf("%s",s1); } what will happen if you executed this code? Ramco4
True or false: If you continuously increment a variable, it will become negative? 1) True 2) False 3) It depends on the variable type  5
Difference between Class and Struct. Motorola6
Reverse a string word by word??  6
What is external and internal variables What is dynamic memory allocation what is storage classes in C  2
WAP TO ACCEPT STRING AND COUNT A COMES N TIMES B COMES N TIMES C COMES N TIMES D COMES N TIMES AND SO ON......... AT LAST UNTIL Z COMES N TIMES...............  3
differentiate between const char *a; char *const a; and char const *a; HCL1
write a own function for strstr LG-Soft1
main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); } CitiGroup17
What are the commands should be given before weiting C Program i.e, Cd.. like Infonet3
What are the different pointer models in c?  3
how to make program without <> in library. ADITI1
Which of the following about automatic variables within a function is correct ? a.its type must be declared before using the variable b.they are local c.they are not initialised to zero d.they are global. TCS3
Write a c code segment using a for loop that calculates and prints the sum of the even integers from 2 to 30, inclusive?  2
Write a program to print all the prime numbers with in the given range ABC1
How the C program can be compiled? HP7
Write a program in c to input a 5 digit number and print it in words.  1
write a program to generate 1st n fibonacci prime number  1
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com