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                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
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
wap to print "hello world" without using the main function.
 Question Submitted By :: Rockon2050
I also faced this Question!!     Rank Answer Posted By  
 
  Re: wap to print "hello world" without using the main function.
Answer
# 1
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 ?    9 Yes 8 No
Vignesh1988i
 
  Re: wap to print "hello world" without using the main function.
Answer
# 2
by using the comment lines we can get the output
 
Is This Answer Correct ?    4 Yes 14 No
Thirupathi Reddy
 
 
 
  Re: wap to print "hello world" without using the main function.
Answer
# 3
To display "hello world"
 
 printf("\"hello world\"");
 
Is This Answer Correct ?    2 Yes 29 No
Raghuram
 
  Re: wap to print "hello world" without using the main function.
Answer
# 4
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 ?    2 Yes 8 No
Kk
 
  Re: wap to print "hello world" without using the main function.
Answer
# 5
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 ?    2 Yes 7 No
Kk
 
  Re: wap to print "hello world" without using the main function.
Answer
# 6
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 ?    13 Yes 4 No
Kk
 
  Re: wap to print "hello world" without using the main function.
Answer
# 7
#include<stdio.h>
#include<conio.h>
printf("hello world");
 
Is This Answer Correct ?    1 Yes 23 No
Guest
 
  Re: wap to print "hello world" without using the main function.
Answer
# 8
#include<stdio.h>
#define nitish main
void nitish()
{
printf("Hello World");
}
 
Is This Answer Correct ?    14 Yes 5 No
Nitish_bhasin
 
  Re: wap to print "hello world" without using the main function.
Answer
# 9
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 ?    7 Yes 5 No
Manne Ranjith
 
  Re: wap to print "hello world" without using the main function.
Answer
# 10
its not possible.
 
Is This Answer Correct ?    6 Yes 4 No
Abhradeep Chatterjee
 
  Re: wap to print "hello world" without using the main function.
Answer
# 11
Use pragma directive if you want to do something before 
executing main function..
 
Is This Answer Correct ?    4 Yes 0 No
Smarty Coder
 
  Re: wap to print "hello world" without using the main function.
Answer
# 12
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 ?    3 Yes 1 No
Niranjan Vg
 
  Re: wap to print "hello world" without using the main function.
Answer
# 13
compile the above file using the following command

# gcc -nostartfiles <filename.c>

# ./a.out
 
Is This Answer Correct ?    3 Yes 0 No
Niranjan Vg
 
  Re: wap to print "hello world" without using the main function.
Answer
# 14
#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 ?    1 Yes 0 No
Ranjan
 
  Re: wap to print "hello world" without using the main function.
Answer
# 15
the question is wrong
 
Is This Answer Correct ?    0 Yes 1 No
Goutam Kumar Das
 
  Re: wap to print "hello world" without using the main function.
Answer
# 16
#include<stdio.h>
#include<conio.h>
#define uttam main
uttam()
{
printf("hello world");
getch();
return 0;
}
 
Is This Answer Correct ?    0 Yes 0 No
Uttam Kumar Das
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
what are the interview question's in the language c Nipuna1
Which of the following data structures is on average the fastest for retrieving data: 1) Binary Tree 2) Hash Table 3) Stack  3
what will be the output: main(){char ch;int a=10;printf("%d",ch);} Wipro29
parkside's triangle.. create a program like this.. enter the size: 6 enter the seed: 1 output: 1 23 456 7891 23456 789123 sample2: enter the size: 5 enter the seed: 3 output: 3 45 678 9123 45678 parkside should not exceed 10 while its seed should only be not more than 9..  4
main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); } CitiGroup17
program to find middle element of linklist? Huawei1
What is the purpose of Scanf Print, getchar, putchar, function?  2
How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST Adobe2
What is RAM memory? and What is ROM?Who designed one is temparary and another is permanent?why they designed like that?By using far pointer which type data(whether hexadecimal)we can access? Excel1
write a c program to accept a given integer value and print its value in words  3
What's wrong with "char *p; *p = malloc(10);"?  5
main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output?? Ramco13
what is the definition of storage classes? Wipro2
Can we access RAM? How? Whats the range of access? Similarly What are other hardware we can access?  1
what is the output of below pgm? void main() { int i=0; if(i) printf("pass"); else printf("fail"); }  3
C,c++, Java is all are structural oriented or procedure oriented language..?  3
what is dangling pointer? LG-Soft1
char ch=10;printf("%d",ch);what is the output Accenture11
size maximum allocated by calloc() DELL1
what is a c-language.what is do. HCL3
 
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