Guest

What is the significance of 'void' in --void main()-- ? Please explain me about this in detail I'll surely approve all correct answers.

What is the significance of 'void' in --void main()-- ?


Please explain me about this in detail


I'll surely approve all correct answers.

Grade:11

2 Answers

suryakanth AskiitiansExpert-IITB
105 Points
13 years ago

Dear Nitin,

Main is a driver function. Void is a return type of the main function void means not returning any thing.
The program execution starts from the function main this means main is a starting point of your program.

Please feel free to ask your queries here. We are all IITians and here to help you in your IIT JEE preparation.

All the best.

Win exciting gifts by answering the questions on Discussion Forum. So help discuss any query on askiitians forum and become an Elite Expert League askiitian.

Now you score 5+15 POINTS by uploading your Pic and Downloading the Askiitians Toolbar  respectively : Click here to download the toolbar..

 

Askiitians Expert

Suryakanth –IITB

Nitin Gupta
16 Points
13 years ago

Not returning anything means not returning a value.But we do return a value in  programs.For ex:-

#include<iostream.h>

#include<conio.h>

void main()

{

int a,b;

cout<<"Enter two values : ";

cin>>a>>b;

cout<<"\n Sum is : "<<a+b;

getch();

}

In this example we do return a value of -- a+b;But the void function doesn't return a value.So where I got wrong?Please let me know

Think You Can Provide A Better Answer ?

ASK QUESTION

Get your questions answered by the expert for free