I'm trying to understand the concept of a fixed size in an array. Consider the following array:
int arr[1] = {0};
Now, if I subscript arr
by any unsigned value greater than 0
, I will get undefined values.
But if I do:
arr[1] = 42;
Now index 1
of arr
holds 42
. I can keep doing this assignment to any index of arr
, making arr
hold more than one int
, which it was originally defined as.
How is arr
having a fixed size if I can keep assigning multiple int
s to its indices?
Aucun commentaire:
Enregistrer un commentaire