Newbie questions:
In the following code snippet I define an array pt with ntri*3 elements. ntri is a command line parameter and therefore not available at runtime. Surely the compiler cannot know what size pt is. Something tells me I should malloc that array - is this necessary and to what size? I'm from a FORTRAN background and used to dynamic allocation of arrays. Any direction would be appreciated.
Code:typedef struct { float x,y,z; } point; int main(int argc, char *argv[]) { int ntri=atoi(argv[1]); point pt[ntri*3]; //do something with pt ... return 0; }