Question: What is the difference between storing a function call in a variable versus storing the value returned by a function in a variable in C++?

What is the difference between storing a function call in a variable versus storing the value returned by a function in a variable in C++? For example

int LowStake::payOut(int &totalRand, int &creditPaidOut) { if (totalRand <= 14 || totalRand > 20) { creditPaidOut = buyIn * 0; } else if (totalRand == 15) { return (creditPaidOut * 0.25); } else if (totalRand == 16) { return (creditPaidOut * 0.5); } else if (totalRand == 17) { return creditPaidOut; } else if (totalRand == 18) { return (creditPaidOut * 1.25); } else if (totalRand == 19) { return (creditPaidOut * 1.5); } else { return (creditPaidOut * 2); } return creditPaidOut; }

int x = Payout();

int y = creditPaidOut

When I cout x and y i don't have a value rather I am instead seeing something which looks like a memory address.

Help please

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!