how to execute with out main in cprogram
Answers were Sorted based on User's Feedback
#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 |
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 |
Answer / rupesh
#include<stdio.h>
#define hello main
void hello()
{
printf(" HIIIII ");
}
Is This Answer Correct ? | 3 Yes | 0 No |
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 |
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 |
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 |
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 |
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 |
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
2 Answers HCL, IBM, Satyam, Vimal, Vimukti Technologies,
write a program to display the numbers in the following 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4
write a c program to find the sum of five entered numbers using an array named number
What is main () in c?
when user give a number it multiply with 9 without useing '+' and '*' oprator
Write a Program to accept different goods with the number, price and date of purchase and display them
struct ptr { int a; char b; int *p; }abc; what is d sizeof structure without using "sizeof" operator??
c programming of binary addition of two binary numbers
34.what are bitwise shift operators? 35.what are bit fields? What is the use of bit fields in a structure declaration? 36.what is the size of an integer variable? 37.what are the files which are automatically opened when a c file is executed? 38.what is the little endian and big endian? 39.what is the use of fflush() function? 40.what is the difference between exit() and _exit() functions? 41.where does malloc() function get the memory? 42.what is the difference between malloc() and calloc() function? 43.what is the difference between postfix and prefix unary increment operators?
What are the application of c?
Who had beaten up hooligan "CHAKULI" in his early college days?