Problem Solving with C++ (9th Edition)
Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 9.2, Problem 14STE

What is the output of the following code fragment? The code is assumed to be embedded in a correct and complete program.

int arraySize = 10;

int *a;

a = new int[arraySize];

int i;

for (i = 0; i < arraySize; i++)

  * (a + i) = i;

for (i = 0; i < arraySize; i++)

  cout << a[i] << “ ”;

cout << endl;

Blurred answer
Students have asked these similar questions
Program in C language (Please solve part 2) Part one : Write a program that does the following: Creates int array array_1 of length 10. Creates int array array_2 of length 10. Takes int values from the user of for 10 values for array_1 and array_2, each. Creates a new int array array_3 which copies the values of array_1 and array_2, in interleaved order, into it. Prints out the contents of Prints out the contents of array_1, array_2 and array_3. Part two : Repeat Part one, but this time use arrays of char (instead of int), and stop receiving input into array_1 and array_2 when the user hits Enter / newline and insert a Null character into the array
Write a function that gets an array as a parameter (address and size) and a number and checks to see if that number exists in the array. The function should report every single occurrence of the number in the array.  It should also report how many occurrences were detected in total (use c code)Suggested prototype:    void findnReport(int* ar, int size, int num)   Example of function output:  If array = {2,5,3,5,12,13,14,15,0,5,-1,11,5} and num = 5, Number 5 found in array index 1 Number 5 found in array index 3 Number 5 found in array index 9 Number 5 found in array index 12 Total of 4 occurrences of number 5
One dimension array in C:Create an array of 100 integer elements and initialize the array elements to zero.Populate the array (using a for loop) with the values 10,20,30,..., 990,1000.Write code (using for loops) to sum all the elements and output the sum to the screen. without using #define

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License