Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Draw the stack at the execution point for below program #include using namespace std; int main(); void print_array( int a[], int s) { // YOUR

Draw the stack at the execution point for below program

#include

using namespace std;

int main();

void print_array(int a[], int s) { // YOUR STACK DRAWING

int i;

for(i=0; i < s; i++) {

printf("%d:%d, ", i, a[i]);

}

printf(" ");

}

/***********************************/

int mystery(int a[], int s, int y){

int i, val;

val = 0;

for(i = 0; i < s; i++) {

if(a[i] > y) {

val++;

a[i] = a[i] - y;

}

}

// DRAW THE STACK WHEN EXECUTION GETS HERE

return val;

}

/*************************************/

int main() {

int i, myarray[10], num;

for(i=0; i < 10; i++) {

myarray[i] = i;

}

printf("Before: ");

print_array(myarray, 10);

num = mystery(myarray, 7, 3);

printf("After: num = %d ", num);

print_array(myarray, 10);

}

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_2

Step: 3

blur-text-image_3

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

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

Students also viewed these Databases questions

Question

What is a board of directors?

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago