Hey guys,
I am wondering if it is possible to receive a value from a command line that creates an array of that size?
Is the more 'sophisticated' method of doing this to use malloc()?
Thanks.
Printable View
Hey guys,
I am wondering if it is possible to receive a value from a command line that creates an array of that size?
Is the more 'sophisticated' method of doing this to use malloc()?
Thanks.
Yes, it is possible.Quote:
Originally Posted by Cell
I am not sure how 'sophisticated' it is, but it is the usual way. In C99 you also have the option of variable length arrays.Quote:
Originally Posted by Cell
Thank you.
So if I am using a VLA, is it as simple as:
Because I have been having some issues using this.Code:
int TEST;
printf("Message size?\n");
scanf("%d", &TEST);
int string[TEST];
Thanks.
Is C99 mode standard in gcc?
If it compiles without warnings with you scattering variables throughout your code like that, then yes, it's in C99 (or some bastardized) mode.
Quzah.