8.0k views
4 votes
Write the code to call a function named send_variable and that expects a single int parameter. Suppose a variable called x refers to an int. Pass this variable as an argument to send_variable.

User Feihcsim
by
3.4k points

1 Answer

4 votes

Answer:

#include <iostream>

using namespace std;

//function definition

void send_variable(int num){

cout<<"The Number is "<<num<<endl;

}

// main function begins here

int main()

{

int x =15; //declares an it variable and assigns 15

// Calls the function send_variable

send_variable(x);

return 0;

}

Step-by-step explanation:

Using C++ programming language we created the function called send_variable and in the main function we call this function which only displays the value of an int variable passed unto it.

User Michael Arrison
by
2.9k points