How can I declare an array with a variable, but without using malloc() in C?

ساخت وبلاگ

Vote count: 0

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?

asked 43 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : how can it be lyrics,how can it be,how can i keep from singing,how can i vote,how can it be chords,how can i make money,how can i get a loan,how can i vote early,how can i make money from home,how can i lose weight fast, نویسنده : استخدام کار backsoft بازدید : 413 تاريخ : يکشنبه 16 آبان 1395 ساعت: 6:19