answersLogoWhite

0


Best Answer

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

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can Array-based lists can never be empty?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What to do in an empty noteboook?

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


Why does an empty wallet always stay empty?

Because there's never any change in it.


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.


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.


How many ocelots were there in the 1900s?

Certainly in the many thousands, as ocelots have never been on endangered lists.


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


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


Chicago newspaper lists of divorces for October 2009?

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