Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Allocate an array of 100 integer pointers and assign the resulting pointer to the appropriately declared variable, ip_arr. Allocate 100 integers and assign the
C++
Allocate an array of 100 integer pointers and assign the resulting pointer to the appropriately declared variable, ip_arr. Allocate 100 integers and assign the resulting pointers to the elements of ip_arr. Initialize each integer value to -1.
this is what i have but it generates an error:
int *ip_arr = new int [100]; for(int i = 0; i < 100; i++) { *ip_arr[i] = new int(-1); }
here is the error:
CTest.cpp:5:11: error: invalid type argument of unary * (have int) *ip_arr[i] = new int(-1); ^
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started