Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Consider the following program. Assume all variables are declared and the program compiles. #include using namespace std; void getVal(int&, int&); void procVal(int, int&); int

C++

  1. Consider the following program. Assume all variables are declared and the program compiles.

#include

using namespace std;

void getVal(int&, int&);

void procVal(int, int&);

int x;

int main() {

int intNum1;

int intNum2;

x = 6;

getVal(intNum1, intNum2);

cout << intNum1 << " " << intNum2 << " " << x << endl;

procVal(intNum1, intNum2);

cout << intNum1 << " " << intNum2 << " " << x << endl;

return 0;

}

void getVal(int& a, int& b)

{

cout << Enter value for a: << endl;

cin >> a; /// The user enters 1

cout << Enter value for b: << endl;

cin >> b; /// The user enters 2

x = a * b;

}

void procVal(int u, int& v)

{

int intNum3;

intNum3= x;

v = intNum3 * 4;

u = u - v;

}

Answer the following question:

A. Considering the function procVal, parameter 1 is called by value. What occurs in memory for parameter 1 and local variable int intNum3? Hint: consider memory, parameters and local variables

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago