Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how to execute with out main in cprogram

Answers were Sorted based on User's Feedback



how to execute with out main in cprogram..

Answer / ravinder rawat

#include<stdio.h>
#define ravinder(z,g,c,f,x,y) z##c##y##x
#define rawat ravinder(m,b,a,j,n,i)

void rawat()
{ printf("MGM NOIDA");
getch();}

Is This Answer Correct ?    43 Yes 11 No

how to execute with out main in cprogram..

Answer / sushil kumar

Well Done !!!!!!!
I can give an explanation
When a c program is compiled the preprocessor process the code and replace the macros in the code
IN void rawat()
#define rawat ravinder(m,b,a,j,n,i) replaces rawat so code becomes
void ravinder(m,b,a,j,n,i)()
which calls the first macro to replace ravinder(m,b,a,j,n,i) by m##a##i##n i.e main
so now we have
void main()

that's why this code executes correctly
C always requires a main program to execute

Is This Answer Correct ?    23 Yes 1 No

how to execute with out main in cprogram..

Answer / rupesh

#include<stdio.h>
#define hello main

void hello()
{
printf(" HIIIII ");
}

Is This Answer Correct ?    3 Yes 0 No

how to execute with out main in cprogram..

Answer / sathish

Well done Ravinder. I appreciate your answer.

Is This Answer Correct ?    2 Yes 0 No

how to execute with out main in cprogram..

Answer / gaurav

At most websites i read that no c prg. can be without main
but this was surprising
i never thought it could be done with such twist
good one

Is This Answer Correct ?    2 Yes 2 No

how to execute with out main in cprogram..

Answer / mahender

with out main() program xecution not posible
bt compiling is posible
bcoz prog. starts on main fun only

Is This Answer Correct ?    0 Yes 0 No

how to execute with out main in cprogram..

Answer / himanshu

ans 13 is not totally right!
you see you have used main straight away.
you aren't supposed to use main any where in the code.

Is This Answer Correct ?    0 Yes 0 No

how to execute with out main in cprogram..

Answer / himanshu rajput

Sushil kumar is right.exactly this is being happened in that program.That program is also using main function by the reference of other name.so c program always requires main function and does'nt have any mean without main.
but we do'nt need to write clrscr() and getch() function to our program in latest compilers like as DEV-C++.

Is This Answer Correct ?    0 Yes 0 No

how to execute with out main in cprogram..

Answer / rishabh

dude how it worked!!!!!!!

Is This Answer Correct ?    1 Yes 2 No

how to execute with out main in cprogram..

Answer / guest

clever code , I dnt know macros much
how u managed to run it
pls explain...

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Interview Questions

what is stack , heap ,code segment,and data segment

0 Answers  


If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above

0 Answers  


Explain what are preprocessor directives?

0 Answers  


Write a program that takes a 5 digit number and calculates 2 power that number and prints it

5 Answers   ABS, Accenture, HCL, Infosys, Infotech, SoftSolve, Software India, TCS, Vertex, Vimukti Technologies,


what is the output of the code and how? main() { int *ptr,x; x=sizeof(ptr); printf("%d",x); }

1 Answers  


#include<stdio.h> void main() { int a,b,c; a=b=c=1; c=++a || ++b && ++c; printf("%d\t%d\t%d",a,b,c); }

3 Answers  


Why main is used in c?

0 Answers  


Write a code to generate divisors of an integer?

0 Answers   Ericsson,


Write a program to check prime number in c programming?

0 Answers  


wtite a program that will multiply two integers in recursion function

4 Answers   TCS,


Define VARIABLE?

0 Answers   ADP,


What is time complexity c?

0 Answers  


Categories