Author Topic: quick C question  (Read 1180 times)

Stryker

  • VIP
  • Member
  • ***
  • Posts: 1,258
  • Kudos: 41
quick C question
« 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]

flap

  • Member
  • **
  • Posts: 1,268
  • Kudos: 137
quick C question
« Reply #1 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.
"While envisaging the destruction of imperialism, it is necessary to identify its head, which is none other than the United States of America." - Ernesto Che Guevara

http://counterpunch.org
http://globalresearch.ca


Stryker

  • VIP
  • Member
  • ***
  • Posts: 1,258
  • Kudos: 41
quick C question
« Reply #2 on: 1 September 2003, 14:05 »
i knew that, i was just testing ya  ;)  

thanks

xyle_one

  • VIP
  • Member
  • ***
  • Posts: 2,213
  • Kudos: 135
quick C question
« Reply #3 on: 30 October 2003, 04:11 »
itm