Arrays

who or what determines the amount of data that one slot of an array can hold.

That is determined by the type of array you have.
meaning if its integer each slot by default holds a certain amount, and if char
it will hold a certain amount. if it is char each slot will hold one byte?
char only holds 1 byte
int holds 2 byte

the sizes of the index is determined by the variable type. i.e.

int arr[5]; // each index is allotted 2 bytes to hold an interger, so you wont be able to use decimals in the array. you would have to declare the variable type for that i.e. double arr[5];

so the user determines the amount of data that one index of the array can hold.
the user tells what datatype he wants and the compiler gives each element in the array the size that datatype has on the system.

an integer can be 32bit but on other systems int may be 64 bit

so the size depends in the first instance on the user and in second instance on the compiler
Topic archived. No new replies allowed.