answersLogoWhite

0


Best Answer

Array indices are zero-based because the first element is at offset zero from the start of the array. There is no such thing as a one-based array in C. Some other languages do allow you to specify the base of an array, but converting a non-zero-based index to a zero-based index adds a runtime overhead to the implementation.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar
More answers
User Avatar

Matthias Schuster

Lvl 2
2y ago

Most often with 0. Lua and some others start with 1.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

at 0

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you start array list from 1?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can Array-based lists can never be empty?

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;


Two linked list in a array is possible?

Like this: #define MAXLIST 100 int first, next [MAXLIST]; /* let the list be: #0 ---> #2 ---> #1 */ first= 0; next[0]= 2; next[2]= 1; next[1]= -1; /* means end of list */ Note: you should track which elements are unused, in the beginning every elements are unused: int first_unused= 0; for (i= 0; i<MAXLIST; ++i) next[i]= i+1; next[MAXLIST-1]= -1; /* means end of list */


Create a mark list using array with structure?

sorce code for student mark list usig array


How do you swap rows in 2 dimensional array in Java?

[]temp = array[1] array[2]=array[1] array[1]=[]temp


How do you swap two adjecent no in array in c?

Option 1) Use a temporary variable: int x = array[i]; array[i] = array[i+1]; array[i+1] = x; Option 2) Use bit operators: array[i] ^= array[i+1] ^= array[i];

Related questions

Can Array-based lists can never be empty?

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;


PHP program to find the minimum number among a list?


Two linked list in a array is possible?

Like this: #define MAXLIST 100 int first, next [MAXLIST]; /* let the list be: #0 ---> #2 ---> #1 */ first= 0; next[0]= 2; next[2]= 1; next[1]= -1; /* means end of list */ Note: you should track which elements are unused, in the beginning every elements are unused: int first_unused= 0; for (i= 0; i<MAXLIST; ++i) next[i]= i+1; next[MAXLIST-1]= -1; /* means end of list */


What is array literal in as2?

An array literal is a comma-separated list of the elements of an array. An array literal can be used for initializing the elements of an array.


Create a mark list using array with structure?

sorce code for student mark list usig array


How would you use the word array in a sentence?

An array is a list of data items or variables of the same type, like a list of numbers or a list of dates or a list of names.


Can linked list represent in array if yes show how insertion and deletions can perform in array representation of inked list?

yes


How do you swap rows in 2 dimensional array in Java?

[]temp = array[1] array[2]=array[1] array[1]=[]temp


How do you swap two adjecent no in array in c?

Option 1) Use a temporary variable: int x = array[i]; array[i] = array[i+1]; array[i+1] = x; Option 2) Use bit operators: array[i] ^= array[i+1] ^= array[i];


Complexity of an algorithm in data structure?

* search array => O(1) linked list=> O(n) binary tree=> O(log n) hash=>O(1) * search array => O(1) linked list=> O(n) binary tree=> O(log n) hash=>O(1)


Which is better vector or array list?

It depends... If you want a speedy processing go for array list If you want thread safety go for a vector


What would the valid subscript values be in a four element array of doubles?

since the array is four elements and array subscripts start at zero, the valid ones would be 0, 1, 2, 3