Stop Microsoft

Miscellaneous => Programming & Networking => Topic started by: Stryker on 1 September 2003, 13:45

Title: quick C question
Post by: Stryker on 1 September 2003, 13:45
aside from the fact that it's useless, what's wrong with this code? At the very end, after the last printf() i get a segmentation fault.

thanks

Code: [Select]
Title: quick C question
Post by: flap on 1 September 2003, 13:59
Change this

for (x=1;x<9;x++)

to

for (x=0;x<8;x++)

Arrays are indexed from 0, not 1. i.e. your array is indexed from 0 to 7, not 1 to 8.
Title: quick C question
Post by: Stryker on 1 September 2003, 14:05
i knew that, i was just testing ya  ;)  

thanks
Title: quick C question
Post by: xyle_one on 30 October 2003, 04:11
itm