Question -
Answer -
The Function prototype serves the following purposes :
It tells the return type of the data that the function will return.
It tells the number of arguments passed to the function.
It tells the data types of each of the passed arguments.
Also it tells the order in which the arguments are passed to the function.
#include
int timesTwo(int num); // function
prototype int main()
{
int number,response;
cout<<"Please enter a number:";
cin>>number;
response = timesTwo(number); //
function call
cout<<"The answer is"<
return 0;
}
//timesTwo function
int timesTwo (int num)
{
int answer; //local variable
answer = 2*num;
return(answer);
}
Comment(S)
Show all Coment
Leave a Comment