I'm newbie to C. And studying about Array. tutor says the number in the bracket defines the memory size allowed to the array.
for example, if I define array like
int luckyNumbers[10]
this array can't swallow more than 10 elements. However, it swallows more than 10, although it still says its size as 10.
here's what i've done
int main()
{
int luckyNumbers[10];
size_t n = sizeof(luckyNumbers)/sizeof(int);
printf("%d\n", n); // "10"
luckyNumbers[1] = 80;
luckyNumbers[2] = 80;
luckyNumbers[3] = 80;
luckyNumbers[4] = 80;
luckyNumbers[5] = 80;
luckyNumbers[6] = 80;
luckyNumbers[7] = 80;
luckyNumbers[8] = 80;
luckyNumbers[9] = 80;
luckyNumbers[10] = 80;
luckyNumbers[11] = 80;
luckyNumbers[12] = 90;
printf("%d\n", luckyNumbers[12]); // "90". working right
size_t n2 = sizeof(luckyNumbers) / sizeof(int);
printf("%d", n2); //still "10". why not 12?
return 0;
}