#include <iostream> using namespace std; void Change( int, int& ); void main( vo
ID: 3554574 • Letter: #
Question
#include <iostream>
using namespace std;
void Change( int, int& );
void main( void )
{
int a = 10, b = 7;
Change( a, b );
cout << a << " " << b << endl;
Change( b, a );
cout << a << " " << b << endl;
}
void Change( int x, int& y )
{
static int b = 4;
b += x;
y += b;
x = y;
return;
}
Part 1:
Give all the line numbers that correspond to each of the following:
a. Function header
b. Function body
c. Function definition
d. Function prototype
e. Function call
part 2:
Draw a memory map for when the program is at line 18 after the second call to Change
Explanation / Answer
a) line 4 and 13
b) body of function main(void) 5-11
body of function change 13- 19
c) definition of function change 13-19 and 5-11
d) function prototype - line 3
e) function call line line 7, 9
2)
a= 10 b=7
after 1st call to change(a,b)
a=10 b=21
after 2nd call to change(b,a)
a=45 b=21
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.