How to create a Java ArrayList in C

You can create array of your lists like this:

Lista **array = (Lista**)calloc(10, sizeof(*array));

for(int i = 0; i < 10; ++i){
    array[i] = (Lista*)malloc(sizeof(**array));
}

or just:

Lista array[10];

but last array will be created on stack and it will not be good for large structures.

Leave a Comment