Firstly, thanks for using tags to format your code. However, you've used the wrong tags. I think you've used the "output" tags, not the code tags. If you use the right tags, then you get line numbers, and context colouring, which makes it easier for us to read and discuss the code.
So, looking at your code:
char* classList; //<-- here is where I don understand how to declare
Here, you've defined a pointer, not an actual array. There is no storage allocated in memory for your array anywhere in your code.
If you want to dynamically allocate memory for your array on the heap, then declaring a pointer is fine, but somewhere in your code you'll need to actually allocate that memory.
On the other hand, if you want to have a fixed-size array, then you'll need to actually declare the array.
1 2 3 4 5 6 7 8
|
void Student::setclassList(char cl) //<-- not sure if I type it correctly
{
for (int x=0; x<50; x++)
{
cl=x;
}
classList=cl;
}
|
This is very wrong, and I assume it doesn't actually compile. You pass in a single character to the function, but you do nothing with the value you pass in. You then overwrite the value of the character 50 times; again, you do nothing with each value before overwriting it. Finally, you try and set the value of
classList to be the same as the final value of
cl, but
classList isn't a character, it's a pointer, so the types are incompatible.
1 2 3 4
|
char Student::*getclassList() //<-- not sure if I type it correctly
{
return getclassList();
}
|
This is infinite recursion. Your function calls itself, and again, and again, and again, until, eventually, the stack will overflow and your program will crash.
It looks to me as though you haven't really understood the fundamentals of arrays. I'd strongly recommend going back to your textbook and re-reading the section on arrays until it makes sense. Alternatively, you might try looking at the tutorial on this site:
http://www.cplusplus.com/doc/tutorial/arrays/