Question: Dynamically allocate an integer array with numClasses elements and assign studentsRegistered with the array's address. The program will read numClasses integers into the array and
Dynamically allocate an integer array with numClasses elements and assign studentsRegistered with the array's address. The
program will read numClasses integers into the array and then print each value.
Please answer in C Thank you.
code I have is
#include "checkSolution.h
#include
using namespace std;
void PrintStudentsint arrayPtr, int arraySize
int i;
if arrayPtr nullptr
for i ; i arraySize; i
cout "Class i : arrayPtri students" endl;
int main
int studentsRegistered nullptr;
int numClasses;
int i;
cin numClasses;
int dynamicarray;
dynamicarray new intnumClasses;
studentsRegistered
dynamicarray;
for i ; i numClasses; i
cin studentsRegisteredi;
PrintStudentsstudentsRegistered numClasses;
delete studentsRegistered;
checkSolution; Check solution for testing purposes only
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
