So I have to create a 2D array which is going to be used to print a histogram. I know that the array is going to be 52 elements wide, but the height of the array is going to be equal to max + 1
, which will be different every time the function it is in gets called. Ideally, the line would accomplish the following function:
char histPlot[max+1][52] = "";
As I was writing my code, however, I learned that C, or at least my compiler, does not allow an array to be declared without a constant value. The professor of the class I'm writing this code for was not clear on whether or not we could use malloc() for this assignment. Assuming I cannot using malloc()
, is there any way I can create the array histPlot[][]
to have a height of exactly max + 1
?