wap to print "hello world" without using the main function.

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

1492


Explain what is the benefit of using enum to declare a constant?

588


Explain what is a stream?

608


How does free() know explain how much memory to release?

621


Tell me is null always defined as 0(zero)?

674






What is nested structure with example?

624


Can we use any name in place of argv and argc as command line arguments?

610


How many levels of pointers can you have?

705


What is malloc and calloc?

573


What is auto keyword in c?

792


What are the 5 types of organizational structures?

550


How can you allocate arrays or structures bigger than 64K?

683


What does node * mean?

712


What is %g in c?

618


Is r written in c?

724