What variables exist in memory just before the statement

Assignment Help Basic Computer Science
Reference no: EM13307956

Read the program below and answer the 3 questions that follow.
#include <stdio.h>
int mystery(int x[], int size);
main()
{
int a[3] = {22, 11, 33}, b;
b = mystery(a, 3);
printf("a[0] = %d, b = %d\n", a[0], b);
}
int mystery(int x[], int size)
{
int i, temp = x[0];
for (i=1; i<size; i++)
{
temp += x[i];
if (x[0] < x[i])
x[0] = x[i];
}
return temp;
}

1. During the execution of the program above, what variables exist in memory just before the statement "return temp;" executes, and what are their values? The values of pointer variables can be specified either by using the address operator & or by assigning names to represent addresses in memory diagrams.

2. During the execution of the program above, what variables exist in memory just before the statement "printf("a[0] = %d, b = %d\n", a[0], b);" executes, and what are their values?

3. Exactly what will be displayed when this program executes?

Reference no: EM13307956

Questions Cloud

Which is a two-dimensional array of integers : You are to create a CourseGrades application that simulates a grade book for a class with six students that each has 5 test scores. The CourseGrades application should use a GradeBook class that has a member variables grades.
Derive formulas to show that normal stresses in rods : Derive formulas to show that normal stresses in rods (1) and (2) are independent of the material used in rods, as long as they have the same modulus of elasticity, that is, E_1 = E_2.
How long did take for the rocket to reach that max height : At that time, there is no more fuel in the rocket engine and the rocket continues upwards in free fall (g=0 ft/sec/sec). (a) How high will the rocket reach before it begins to fall back to the campus
How recursion breaks up complex computational problems : Discuss how recursion breaks up complex computational problems into simpler ones. Identify three problems that would be difficult to solve without the use of recursion. Justify your response in simple C++ syntax.
What variables exist in memory just before the statement : During the execution of the program above, what variables exist in memory just before the statement "printf("a[0] = %d, b = %d\n", a[0], b);" executes, and what are their values?
Find the total energy of the oscillating spring : A 1.20 kg mass on a horizontal spring oscillates on a frictionless surface with a displacement as a function of time given by x(t) = 0.075cos(4.16t â€" 2.45). Find the total energy of the oscillating spring
How to check adequacy of the beam with respect to moment : A reinforced concrete beam having the cross section shown is on a simple span of 28ft. It carries uniform service loads of 3.60 kips/ft live load and 2.20 kips/ft dead load. Check the adequacy of the beam with respect to the moment.
How long does it take for the particles to hit the plate : Suppose that protons are fired towards the large flat side of a charged conducting plate. How long does it take for the particles to hit the plate
Write a program that creates a 4x3 array of integers : Write a program that creates a 4x3 array of integers. Populate the array with random numbers between 0 and 200. Sum up the values in each column and display the three sums to the screen.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Create table-balance on loan at end of month-visual basic

Using Visual basic a tv set is bought with the loan of 563 to be paid off with five monthly payments of 116 interest is 1% per month.

  Reflect upon the it strategies

Reflect upon the IT strategies that are used to encourage economic development. Select two strategies and discuss how economic factors affect the strategies that a government may use to facilitate economic development.

  What is the geometric center frequency

A band-pass filter has a lower cutoff frequency of 100 Hz and an upper cut-off frequency of 144 Hz. What is the geometric center frequency? (Points : 3) 120 Hz 130 Hz 134.5 Hz 140 Hz

  Compute expected payback percentage of machine

Compute the expected "payback" percentage of the machine. In other words, for each coin played, what is the expected coin return?

  Write a class that maintains the top 10 scores

but use a singly linked list instead of an array Part 2: Implement the stack and queue with a single class interfaces with a unique class that is derived from class LinkedDeque (Code Fragment 5.21)

  Use postings intersection procedure to find list of document

Assume we want to use postings intersection procedure to find simply the list of documents which satisfy a /k clause, rather than returning list of positions.

  Who swallowed a cat, imagine that to swallow a cat.

There was an old woman who swallowed a fly. I don't know why she swallowed that fly, Perhaps she'll die. There was an old woman who swallowed a spider, That wriggled and wiggled and jiggled inside he She swallowed the spider to catch the fly, I do..

  Write a method, insertat, that takes four parameters

write a method, insertAt, that takes four parameters: an array of integers; the length of the array; an integer, say insertItem; and an interger, say, index.

  Create a details element that displays the summary

Write an HTML5 element (or elements) to accomplish each of the following tasks: a. Students were asked to rate the food in the cafeteria on a scale of 1 to 10.

  Computing downtime in telephone per year

Telephone system has an availability of 99.999 percent. How much downtime is that per year? Express your answer in a way that is easy for someone to understand.

  Consider a server with poisson job-arrival stream

Consider a server with Poisson job-arrival stream at an average rate of 60 per hour. Determine the probability that the time interval between successive job arrivals is

  Filling all the positions of his cabinet

How many ways are there of filling all the positions of his cabinet if we assume that each position be filled by a different person and do not take into account which position each been has been assigned?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd