0

Is it possible to call a void function from another void function?

will this work?

mainMenu()
{
 int input;
	cout<<"\t\t  Main Menu \n\n";
	cout<<"\t\t 1. Student Details \n";
	cout<<"\t\t 2. Payment Details \n";
	cout<<"\t\t 3.Exit \n\n";
	cout<<"\t\t Select 1/2/3 : ";
	cin>>input;

    	if(input==1)
	{
	   void studentDetails();
	}  
	if(input==2)
	{
	   void printPaidStudents();
	}
	if(input==3)
	{
	   return -1;
	}
	

}

i wrote the voide studentDetails function too...
but the output is not there...
wats wrong in this?

5
Contributors
9
Replies
10
Views
8 Years
Discussion Span
Last Post by valluvanl
0

You're trying to declare functions in mainMenu, not calling them. You don't need to declare the type while calling it.

0
void mainMenu()
void studentDetails();

Add red void. Function header needs the return type.
Delete green void. Function calls DO NOT need the return type.

MosaicFuneral beat me to it!
Edit : So did Majestics.

0

i removed the void infront of the function. but now a compilation error came mentioning the function should have a prototype

0

you have to declare functions before using them,,

return type  function name (parameters list)

in your case

void studentDetails();

and call them

studentDetails();
0

Because you forgot to declare it outside before hand, such as in a header or where-ever.

yea. thanx for da help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.