wap to print "hello world" without using the main function.
Answers were Sorted based on User's Feedback
Answer / sivasankar
#include<stdio.h>
#include<conio.h>
#define ksrct main()
ksrct
{
clrscr();
printf("hello world");
getch();
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / vaibhav
@Deepika some correction:
#include<stdio.h>
#define decode(s,t,u,m,p,e,d) m##s##u##t
#define begin decode(a,n,i,m,a,t,e)
int begin()
{
printf("Hello World");
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / ranjan
#include<stdio.h>
#include<iostream.h>
class World
{
public:
World()
{
printf("Hello world");
}
}
world w1;
Here the object is declared globaly.so when the object is
defined it will call the constructor of that & that will
display the "hello world". no need to write main. as it is
global.
| Is This Answer Correct ? | 2 Yes | 4 No |
Answer / siva
#include<stdio.h>
#include<conio.h>
#define siva main
siva()
{
clrscr();
printf("hello world");
getch();
return 0;
}
| Is This Answer Correct ? | 3 Yes | 5 No |
Answer / vignesh1988i
the basic format or the first executable code line is the
main function in C.... so if we try to print the anything
without main we are trying to modify the basic concepts of C
and this will not look nice....
thank u
| Is This Answer Correct ? | 20 Yes | 24 No |
Answer / kk
And some deserts for Mr. Vignesh1988i ..
For your kind attention sir.. Method main() is not the first
line in any executable... Have you ever heard of
initialization??
Yes you can say what ever the developer writes in any
program starts in main()..
| Is This Answer Correct ? | 3 Yes | 11 No |
Answer / kk
main() method is the entry point for any c/c++ program which
is compiled/linked as executable. C/C++ does not force
anyone to use only main() method as the entry point. This is
only the default behavior and can be changed. This is
generally slightly different for different compiler. But you
can do this.. Simply define any other method say noMe() to
be the entry point for the executable.
Who the hell uses main()to do main stuffs in any
executable.. It should have been called something like
start() ot begin().. :)
Well this is not the answer.. Just little guidance..
| Is This Answer Correct ? | 3 Yes | 16 No |
Answer / thirupathi reddy
by using the comment lines we can get the output
| Is This Answer Correct ? | 7 Yes | 35 No |
void main() { int a=1; printf("%d %d %d",a,++a,a++); } the output is supposed to be 1 2 2....but it is 3 3 1 this is due to calling conventions of C. if anyone can explain me how it happens?
What should malloc() do? Return a null pointer or a pointer to 0 bytes?
What will be printed as the result of the operation below: #include<..> int x; int modifyvalue() { return(x+=10); } int changevalue(int x) { return(x+=1); } void main() { int x=10; x++; changevalue(x); x++; modifyvalue(); printf("First output:%d\n",x); x++; changevalue(x); printf("Second output:%d\n",x); modifyvalue(); printf("Third output:%d\n",x); }
6. Which of the Following is not defined in string.h? A)strspn() B)strerror() C)memchr() D)strod()
can anyone please tell me wat is backlogs... i was looking for the job openings where i read this.. eligibility criteria minimum 70% in degree without backlogs. is that arrear.. if so is it standing arrear or history of arrears... please help me...
11 Answers CTS, Indian Navy, L&T, Microsoft, SSB, TCE, TCS,
what is the value of b if a=5; b=++a + ++a
31 Answers Infosys, TCS, Tech Mahindra,
Write a C program to read the internal test marks of 25 students in a class and show the number of students who have scored more than 50% in the test. Make necessary assumptions.
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
Which is better pointer or array?
diff. between *p and **p
What is the difference between struct and union in C?
what is the difference between getch() and getche()?