// Sharissa Sullivan //January 20 2023 // Chapter 9 Array Expander  // C ++  #include using namespace std; // prototype arrayExpander  int* arrayExpander(int[], int size); int main() {     //create an array - orignial  array      int array[] = { 1,2,3, };     int size = 3;     int* arrayPtr = arrayExpander(array, size);     // Print out arrays      for (int i = 0; i, size; i++)     {         cout << arrayPtr[i] << endl;     }     return 0; } // function to create new array  int* arrayExpander(int[], int size) {     // ponits to new array with * size X 2 , and copied vaules from 1st array with 0 for the values      int *expanderArray = new int[size * 2];     // copy orginial array into the second array and doblue the size      for (int i = 0; i < size * 2; i++)     {         if (i < size)         {              // copies the orignal array              expanderArray[i] = array[i]; // LINE 35         }         else         {             //populates the number 0, for the new vaules in exapnder array              expanderArray[i] = 0;         }     }     return expanderArray; } LINE 35 , I am getting an error, can you please run the code and tell me what is wrong

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

// Sharissa Sullivan
//January 20 2023
// Chapter 9 Array Expander 

// C ++ 

#include <iostream>
using namespace std;
// prototype arrayExpander 
int* arrayExpander(int[], int size);

int main()
{
    //create an array - orignial  array 
    int array[] = { 1,2,3, };
    int size = 3;

    int* arrayPtr = arrayExpander(array, size);
    // Print out arrays 
    for (int i = 0; i, size; i++)
    {
        cout << arrayPtr[i] << endl;
    }
    return 0;
}
// function to create new array 
int* arrayExpander(int[], int size)
{
    // ponits to new array with * size X 2 , and copied vaules from 1st array with 0 for the values 
    int *expanderArray = new int[size * 2];
    // copy orginial array into the second array and doblue the size 
    for (int i = 0; i < size * 2; i++)
    {
        if (i < size)
        { 
            // copies the orignal array 
            expanderArray[i] = array[i]; // LINE 35
        }
        else

        {
            //populates the number 0, for the new vaules in exapnder array 
            expanderArray[i] = 0;
        }

    }
    return expanderArray;
}

LINE 35 , I am getting an error, can you please run the code and tell me what is wrong 

100 %
6 7 8 19 2012 234 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 48 1 2 3 4 45 46 47 48
16
17
18
40
41
42
43
44
|
8
Error List
Entire Solution
Code
abc E0441
C2955
// Print out arrays
for (int i = 0; i, size; i++)
{
Error List Output
}
return 0;
Eint* arrayExpander(int[], int size)
{
cout << arrayPtr[i] << endl;
arrayExpand
Search Online
// function to create new array
{
// ponits to new array with * size X 2, and copied vaules from 1st array with for
int *expanderArray = new int[size * 2];
// copy orginial array into the second array and doblue the size
for (int i = 0; i < size * 2; i++)
(local variable) int *arrayPtr
if (i < size)
{
}
else
x 1 AO
// copies the orignal array
expanderArray[i] = array[i];
//populates the number 0, for the new vaules in exapnder array
expanderArray[i] = 0;
return expanderArray;
2 Errors A 0 Warnings
0 of 1 Message
Description
argument list for class template "std::array" is missing
'std::array': use of class template requires template argument list
Build + IntelliSense
Transcribed Image Text:100 % 6 7 8 19 2012 234 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 48 1 2 3 4 45 46 47 48 16 17 18 40 41 42 43 44 | 8 Error List Entire Solution Code abc E0441 C2955 // Print out arrays for (int i = 0; i, size; i++) { Error List Output } return 0; Eint* arrayExpander(int[], int size) { cout << arrayPtr[i] << endl; arrayExpand Search Online // function to create new array { // ponits to new array with * size X 2, and copied vaules from 1st array with for int *expanderArray = new int[size * 2]; // copy orginial array into the second array and doblue the size for (int i = 0; i < size * 2; i++) (local variable) int *arrayPtr if (i < size) { } else x 1 AO // copies the orignal array expanderArray[i] = array[i]; //populates the number 0, for the new vaules in exapnder array expanderArray[i] = 0; return expanderArray; 2 Errors A 0 Warnings 0 of 1 Message Description argument list for class template "std::array" is missing 'std::array': use of class template requires template argument list Build + IntelliSense
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Sample Output should look like this 

The given array contains:

1 2 3

The expanded array contains:

1 2 3 0 0 0

Can you review your code and make corrections ?

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Array
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education