// 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
// 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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fc317763d-1fa7-4bbf-8337-a2804d7c778b%2F29d29070-a910-4883-ade4-3a99adbefff2%2Fbjpvyxj_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 4 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
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 ?
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)