I need to set the size of some arrays in the header file. Is it possible. The thing is that i'm programming SystemC, which is C++ with a twist, and i don't really know that much about C++ and headers.
I need to set the size of some arrays in the header file. Is it possible. The thing is that i'm programming SystemC, which is C++ with a twist, and i don't really know that much about C++ and headers.
What do you mean??
to set the size of an array within a header file???
If the arrays in the header files are staticly declared arrays, such as:
int array[10];
Then you can't set the size at run-time. However, if the arrays are just pointers then you can easily do it with dynamic memory allocation:
// Header
int *array;
// Main
cin>>size;
array = new int[size];
-Prelude
My best code is written with the delete key.