Advertisement

User Defined Arrays

Started by July 01, 2000 04:14 PM
0 comments, last by Reactivore 24 years, 5 months ago
Whoever can help, I was wondering how, if possible, I could create a user defined array or an array that would define itself at runtime. Or would I just have to use like a linklist or something. Any advice would be appreciated.
Dynamic memory allocation:

int* array;

int main()
{
//...
int length;
cin >> length;
array = new int[length];
//...
delete[] array;
}

Of course, you need to check if the allocation was successful, but that''s how it''s done.

This topic is closed to new replies.

Advertisement