C prigraming have a negtive index????Like mean a[-1]; | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

C prigraming have a negtive index????Like mean a[-1];

2nd Sep 2018, 11:18 AM
Mari Raja.S
Mari Raja.S - avatar
3 Réponses
0
nope
2nd Sep 2018, 1:50 PM
‎ ‏‏‎Anonymous Guy
0
why
2nd Sep 2018, 3:29 PM
Mari Raja.S
Mari Raja.S - avatar
0
Mari Raja.S index no. of arrays are relative to their distance from the first address. so 0th position would be the address itself, 1st position is 0th address + 1 and so on. Now negative index would be like going to 0th address - 1, which is not allocated to the array. This would result in a segmentation fault error. Hope this helped
2nd Sep 2018, 5:08 PM
‎ ‏‏‎Anonymous Guy