answersLogoWhite

0

It's either an array or it's a list, it cannot be both. However, an empty array is entirely possible:

std::vector<int> my_vector; // an empty array

my_vector.push_back(42); // an array of 1 element

my_vector.push_back(1); // an array of 2 elements

my_vector.clear(); // an empty array

An empty list is also possible:

std::list<int> my_list; // an empty list

my_list.push_back(42); // a list of 1 element

my_list.push_back(1); // a list of 2 elements

my_list.clear(); // an empty list

The same thing can be done in C:

int* my_array = nullptr; // an empty array

my_array = malloc (2*sizeof(int)); // an array of 2 elements

my_array[0] = 42;

my_array[1] = 1;

free my_array; // an empty array

my_array = 0;

User Avatar

Wiki User

10y ago

What else can I help you with?

Related Questions

What to do in an empty noteboook?

plot ways to destroy the world, write your goals, to do lists, prayer lists, etc.


What is the room that can never be filled?

An empty room. If you start to fill it, it's no longer an empty room.


Why does an empty wallet always stay empty?

Because there's never any change in it.


What can be half full and full but never empty?

my tummy


Can a chickens full crop kill her if it does not empty?

no i don't think so. It is very stretchy and is designed to empty quickly. I have chickens and i have never experienced it.


Always old sometimes new never sad sometimes blue never empty sometimes full never pushing always pulling what are you?

The moon.


Always old sometimes new never sad sometimes blue never empty sometimes full never pushes always pulls?

The moon.


What is holloware?

Any part of the computer can be a holloware when that part is never used or is an empty part of the system.


Can liquid ibuprofen cause indigestion?

yes... take iburofen with food. never on an empty stomach


Chicago newspaper lists of divorces for October 2009?

I've never seen divorces published in a public publication.


Write a program for merging two linked lists?

If you mean merging two sorted list, that would be like this: to= empty WHILE NOT empty(a) OR NOT empty(b) DO IF empty(b) OR first(a)&lt;first(b) THEN append(to, first(a)) a:= next(a) ELSE IF empty (a) OR first(a)&gt;first(b) THEN append(to, first(b)) b:= next(b) ELSE IF first(a)=first(b) THEN append(to, first(a)) append(to, first(b)) # if you want duplicates in the output a:= next(a) b:= next(b) END IF END WHILE


What are the 4 types of legislative lists in India?

Union Lists for central govt. State lists for state govt. concurrent lists for state and union residuary lists for lists that do NT come in the other 3 lists