I'm working on an exercise and can't seem to figure out what's going wrong. The prompt reads, "The variable cp_arr has been declared as an array of 26 pointers to char. Allocate 26 character values, initialized to the letters 'A' through 'Z' and assign their pointers to the elements of cp_arr (in that order)."
Edit: this post was flagged as a duplicate to a post involving pointers and strings, this isn't the same issue.
While testing the code, this is what I've come up with, but the output isn't exactly what I was expecting.
#include <iostream>
using namespace std;
int main()
{
char next = 'A';
char* cp_arr[26];
for (int i = 0; i < 26; i++)
{
cp_arr[i] = new char(next);
cout << cp_arr[i] << endl;
next++;
}
system("pause");
}