Function Won't Show Text w/ Dynamic Memory Allocation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
using namespace std;

short*MAX = NULL;
void applyTests (short []);
void displayTests (short []);

int main (void)
{
	short ntests;
	cout << "How many grades would you like to enter: ";
	cin >> ntests;

	short*testscores = new short [ntests];

	MAX = &ntests;

	cout << "Max nTests = " << ntests << endl << endl;

	applyTests (testscores);
	displayTests (testscores);

	delete [] testscores;

	return 0;
}

void applyTests (short tests [])
{
	for (short i = 0; i << *MAX; i++)
	{
		cout << "Test #" << i + 1 << ": ";
		cin >> tests [i];
	}
	cout << endl;
}
void displayTests (short tests [])
{
	for (short i = 0; i << *MAX; i++)
		cout << "Test #" << i + 1 << " is " << tests[i] << endl;
}

I'm practing C++ and I'm trying to assign and display values to the testscores array. But whenever I input how many grades I would like to enter, the program ends without showing the two functions which was next. Any help?
i << *MAX << is the bitwise left shift operator. What you want is <.
@Peter87

Holy cow! I can't believe I actually did that. I need some sleep. Thanks man. It works correctly now.
Topic archived. No new replies allowed.