What will be the values of these variables after executing the following code? int *array =...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
What will be the values of these variables after executing the following code? int *array = new int[10]; int *ptr = array: for (int i=0; i<10; i++) { } *ptr = i; ptr++; array will have garbage and ptr will have value 9. array will have values 0 through 9 and ptr will point to a memory address beyond array[9]. Both array and ptr will point to the same area containing values 0 through 9. Nothing because you can't assign an array to a pointer. What will be the values of these variables after executing the following code? int *array = new int[10]; int *ptr = array: for (int i=0; i<10; i++) { } *ptr = i; ptr++; array will have garbage and ptr will have value 9. array will have values 0 through 9 and ptr will point to a memory address beyond array[9]. Both array and ptr will point to the same area containing values 0 through 9. Nothing because you can't assign an array to a pointer.
Expert Answer:
Answer rating: 100% (QA)
Answer for the given problem is Both array and ptr will ... View the full answer
Related Book For
Statistics For Business Decision Making And Analysis
ISBN: 9780321890269
2nd Edition
Authors: Robert Stine, Dean Foster
Posted Date:
Students also viewed these computer engineering questions
-
What is the value of a $100 investment that earned 6% per year for five years?
-
What is the value of online auctions in e-commerce?
-
What is the value of adding outside directors to yourboard?
-
Santa's Helpers Ltd estimates its income taxes at 35% of pre-tax income. For the quarter ended September 30, pre-tax income was $200,000. Prepare the journal entry to record the estimated income...
-
Consider Beta Company. What percentage of corporate gifts do you imagine are made for this kind of reason? Nearly all? Half? Just a few? Assume that you heard about Beta Company's gift to Youth...
-
How much energy is dissipated in the collision of Checkpoint 7.11? Data from Checkpoint 7.11 A 1000-kg compact car and a \(2000-\mathrm{kg}\) van, each traveling at \(25 \mathrm{~m} / \mathrm{s}\),...
-
What goals should be accomplished during a witness interview? What are the question-asking techniques you can use to accomplish these goals? Give an example of each.
-
Willand Corporation has 50,000 shares of $10 par value common stock outstanding. It declares a 10% stock dividend on December 1 when the market value per share is $16. The dividend shares are issued...
-
How can organizations measure and assess their cultural health and effectiveness, and what metrics and diagnostic tools are available to evaluate cultural dimensions, identify areas for improvement,...
-
The Stratton Township Park is located on a piece of property that contains two golf courses, a swimming pool, and 800 acres of woods and open spaces. Three years ago, the Stratton Park Department...
-
Jessica Inc. purchases debt investments with the intention of trading the investments. Assume the ending value in the investment account (without the FVA) is always $500,000. The following...
-
How much should Town report as unrestricted contribution revenue for 20X6 with respect to the pledges? a. $0 b. $360,000 c. $720,000 d. $800,000 Town Service Center is a voluntary health and welfare...
-
Which of the following accounts of a governmental unit is credited to close it out at the fiscal year-end? a. Appropriations Control b. RevenueProperty Tax c. Budgetary Fund BalanceAssigned for...
-
What do we mean by the term location economies and why is it relevant to international business?
-
On January 2, 20X2, a not-for-profit botanical society received a gift of an exhaustible fixed asset with an estimated useful life of 10 years and no salvage value. The donors cost of this asset was...
-
The initial transfer of cash from the general fund to establish an internal service fund requires the general fund to credit Cash and debit a. Accounts ReceivableInternal Service Fund. b. Transfers...
-
3. A function f has the values shown below: x 1 1.25 1.5 1.75 f(x) 10 8 7 6 a. Use Midpoint rule to approximate f(x)dx b. Use Simpson's rule to approximate f(x)dx 25
-
1. Below is depicted a graph G constructed by joining two opposite vertices of C12. Some authors call this a "theta graph" because it resembles the Greek letter 0. a. What is the total degree of this...
-
(a) Many companies test employees for recreational drug use. What simple diagnostic test procedure for whether the employee has used drugs has sensitivity equal to 1? Recall that the sensitivity of a...
-
A down side to running a call center is the high turnover in the operators who answer calls. As an alternative, some companies have turned to homeshoring. Rather than have operators come to a call...
-
A retail company operates two types of clothing stores in shopping malls. One type specializes in clothes for men, and the other in clothes for women. The sales from a mens clothing store average...
-
A periodic torque with a maximum value of \(1.0 \mathrm{~N}-\mathrm{m}\) at a frequency of \(5.0 \mathrm{rad} / \mathrm{s}\) is applied to a flywheel suspended from a wire. The flywheel has a moment...
-
A mass-spring-damper system is tested to determine the value of \(c\). Assume \(k=10 \mathrm{lb} /\) in and \(m=2\) slug. (a) If the vibrational amplitude is observed to decrease to \(33 \%\) of its...
-
A periodic force \(F(t)=A \cos \omega t\) is applied to the damped system shown in Figure 3.53. Calculate the work done in one cycle during the steady-state response where \(A=50 \mathrm{~N},...
Study smarter with the SolutionInn App