what if we access an element of an array which even doesn't exist (i.e. unvalid element)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what if we access an element of an array which even doesn't exist (i.e. unvalid element)?

actually 'C' never checks the validity of an array index (ordinal number). for e.g. if we declare an array of 10 elements and we are trying to access 12th element, then NO_ERROR will be generated, but result is unpredictable. https://code.sololearn.com/cgV6IncsnQdO/?ref=app

18th May 2017, 11:01 PM
Ranjeet Kumar
Ranjeet Kumar - avatar
1 Answer
+ 7
This is what we call an undefined action since there will be multiple results if we run this multiple times. You can also see more about it on my code here: https://code.sololearn.com/c0Uom0BoVXGe/?ref=app
19th May 2017, 12:31 AM
Wen Qin
Wen Qin - avatar