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?

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

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.

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

you have to declare functions before using them,,

return type  function name (parameters list)

in your case

void studentDetails();

and call them

studentDetails();

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

yea. thanx for da help.

This article has been dead for over six months. Start a new discussion instead.