I have set an int array size of "20" in my code , but when filling it with for loop i noticed i can fill it up to 24 times ! ( i up to 23 , starting with 0 ) before a message shows up : *** stack smashing detected ***: terminated Aborted (core dumped) , so why that happens ? code :
int marks[20], i;
for (i = 0; i <= 23; i++) {
printf("enter la note de letudiant ! \n");
scanf("%d", & marks[i]);
}
for (i = 0; i <= 23; i++) {
printf("%d\n", marks[i]);
}