Why this array overflow happening in c | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

Why this array overflow happening in c

https://code.sololearn.com/cZFDbih9YA6C/?ref=app

12th Feb 2019, 11:52 PM
Programmer Raja
Programmer Raja - avatar
2 Réponses
+ 4
U declared a[10] it usually means 10 contiguous memory blocks to store 10 integers but Because u tried to access the value at memory location that wasn't allocated...... results are unpredictable when u do this
13th Feb 2019, 2:17 AM
Saurabh B
Saurabh B - avatar
+ 4
Sometimes it gives error like segmentation fault or may give garbage value
13th Feb 2019, 2:25 AM
Saurabh B
Saurabh B - avatar