60 526
Assignments Done
97,8%
Successfully Done
In April 2018

Answer to Question #8873 in C++ for eva

Question #8873
Hi, I am new to c++ and have a question. In my code I need to use a variable of my void fuction in my main. A simple example is

Void sendvariable (int x)
{
Int x=2
…

}

Int main ()
{
…..

Want to get x from above function and do something on it

}
Expert's answer
You need to declare your function as int function and then return x back:


int sendvariable (){
x=2
& hellip;
return x;
}
&
Int main (){
& hellip;
int x = sendvariable ();
& hellip;
}




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions