wap to print "hello world" without using the main function.
Answers were Sorted based on User's Feedback
Answer / kk
Here is a basic sample which uses main as the entry point..
#include <stdio.h>
#define myProxyMain main
int myProxyMain()
{
printf("\nHello World !!");
getchar();
return 0;
}
Just note that at source level there is no main but once
preprocessing we still have the old main() method.. Which
means we still have the main method in the object module as
well as the executable..
| Is This Answer Correct ? | 37 Yes | 11 No |
Answer / nitish_bhasin
#include<stdio.h>
#define nitish main
void nitish()
{
printf("Hello World");
}
| Is This Answer Correct ? | 40 Yes | 20 No |
Answer / smarty coder
Use pragma directive if you want to do something before
executing main function..
| Is This Answer Correct ? | 14 Yes | 1 No |
Answer / manne ranjith
Using Macros we can solve this.
#include<stdio.h>
#include<conio.h>
#define manne main
void manne()
{
clrscr();
printf("HELLO WORLD\n");
getch();
}
| Is This Answer Correct ? | 27 Yes | 18 No |
Answer / niranjan vg
compile the above file using the following command
# gcc -nostartfiles <filename.c>
# ./a.out
| Is This Answer Correct ? | 10 Yes | 2 No |
Answer / deepika
#include<stdio.h>
#define(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 ? | 7 Yes | 2 No |
Answer / hemanthkumar
#include<stdio.h>
#define hemanth main
public hemanth()
{
printf("hello world");
}
| Is This Answer Correct ? | 5 Yes | 1 No |
Answer / uttam kumar das
#include<stdio.h>
#include<conio.h>
#define uttam main
uttam()
{
printf("hello world");
getch();
return 0;
}
| Is This Answer Correct ? | 8 Yes | 6 No |
Answer / niranjan vg
This is the other way you can use it.....
#include<stdio.h>
int hello();
_start()
{
_exit(hello());
}
int hello()
{
printf("\n \t\t\t\t\tHello World\n");
printf("\n \t \t \t Welome to C in Linux\n");
}
| Is This Answer Correct ? | 6 Yes | 6 No |
Answer / andy
Ranjan's answer was the correct one. And it's what interviewers expect.
use g++ to compile and run this:
#include<stdio.h>
#include<iostream>
class World
{
public:
World()
{
printf("Hello world\n");
}
};
World w1;
int main()
{
printf("Hello world again!!\n");
return 0;
}
| Is This Answer Correct ? | 1 Yes | 1 No |
What is data structure in c programming?
How many levels of indirection in pointers can you have in a single declaration?
0 Answers Agilent, ZS Associates,
who invented c
please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics
What does c in a circle mean?
#include main() { int i=1,j=2; switch(i) { case 1: printf("GOOD"); break; case j: printf("BAD"); break; } }
What are unions in c?
What are multidimensional arrays?
What is a program flowchart?
to get a line of text and count the number of vowels in it
Why is c called "mother" language?
How to add two numbers without using arithmetic operators?
18 Answers College School Exams Tests, e track, Infosys, Pan Parag, Sapient, TCS,