huge arrays

Started by
13 comments, last by gmkwo 20 years, 3 months ago
quote:Original post by DerAnged
Umm is this thread C or C++ if its C than ok VOID MAIN() is ok but in C++ Mmain must return an int (which is why gcc gives u an error for void main())


void main() is not really ok in C either. To quote the ISO/IEC 9899:1999 C standard

quote:5.1.2.2.1 Program startup
The function called at program startup is named main. The implementation declares no
prototype for this function. It shall be defined with a return type of int and with no
parameters:
int main(void) { /* ... */ }
or with two parameters (referred to here as argc and argv, though any names may be
used, as they are local to the function in which they are declared):
int main(int argc, char *argv[]) { /* ... */ }


Advertisement
Ok, thanks for all replies.
In general I am using int main(). There is no problem.
quote:Original post by gmkwo
Ok, thanks for all replies.
In general I am using int main(). There is no problem.
Just curious: What suggestion did you end up using? Half of them were invalid or just bad.
He probaly used good half
this is pretty straight foward dynamic memory allocation:
int xSize, ySize, zSize; // Set these to ur dimenstions float*** myarray;myarray = new float**[xSize];for(int i=0; i < xSize; i++){     myarray[i] = new float*[ySize];     for(int j=0; j < ySize; j++)          myarray[i][j] = new float[zSize];}// Then you need to release that memory when ur done with it in reverse order...for(i=0; i < xSize; i++) {     for(int j=0; j < ySize; j++)           delete [] myarray[i][j];          delete [] myarray[i];}delete myarray;

I hope that helps...

[edited by - samgzman on January 14, 2004 11:53:28 PM]

This topic is closed to new replies.

Advertisement