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

  Implement a system for car dealership

Suppose that you are required to implement a system for a car dealership. The system needs to store information about each customer. This includes the customer's ID number, name, address and contact number.

  Assume that you have a 64-bit architecture

Assume that you have a 64-bit architecture, but you need to work with numbers that are up to 2^4096. Your available programming language can support 64-bit numbers. How would you design software to do this (Use a maximum of one to two paragraphs o..

  Given two stringsa and bcreate a bigger string made char a

Given two strings, A and B, create a bigger string made of the first char of A, the first char of B, the second char of A, the second char of B, and so on. Any leftover chars go at the end of the result

  What cryptographic techniques would be used

Alice's Remanufactured Auto Parts is located in St. Louis, Missouri. Due to the popularity of the lowered price and high quality of remanufactured parts, Alice wants to expand operations to the World Wide Web.

  Expalining protocols essential in data communications

What is meant by protocol? Why are protocols essential in data communications?

  What are preprocessor directives used prevent multiple

What are the preprocessor directives used to prevent multiple includes in C++? Where do you put them in the code

  Customer from the first part of this discussion

Suppose that you learn that the customer from the first part of this discussion is unsure as to whether the database is going to run only during normal business hours or whether it needs to run 24 hours / 7 days a week. Assess the importance of kn..

  Purpose and goals of the mobile self-service

Elaborate on the guidelines for how the self-service Website can be kept current as newer mobile devices are being introduced at a rapid rate and the design of the Website for mobile devices and the interfaces that are applicable to the mobile devic..

  Provide an explanation of hashtables

In your comparison, be sure to include an explanation of one way hashtables are similar to your selected data structure and one way in which they are different.

  A direct-mapped cache with 8 two-word blocks

Based on the following sequence of word addresses generated by the processor:1, 134, 212, 1, 135, 213, 162, 161, 2, 44, 41, 221a) Given a direct-mapped cache with 8 two-word blocks that is initially empty

  Research a writing guide for forensics organization

Your manager has asked you to research and recommend a writing guide that examiners in your computer forensics organization will use for all official written reports.

  How many sensors does snort use

Is Snort an HIDS or an NIDS? 2. How many sensors does Snort use? 3. What does a preprocessor do? 4. Is Snort anomaly-based or signature-based?

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