what is the best solution to create an array of variable size.
If any body could give me the solution of how to create and array of variable size in java or in c++ (Note: except the linked list concept).
Please!
would be very appriciable Thank you!
Since you've posted this question in the C forum I recommend that you look up malloc.
Java has garbage collection and is quite a bit different. There are quite a few different classes that you can use instead of an array. I recommend you check out the ArrayList class.
If you are using C++ you should avoid malloc which is a C function.
If you really want to handle the memory allocation yourself then use new. However if you would like all them memory allocation handled for you use a vector<>
Comment