can't figure out why i'm getting a segmentation fault error


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  while(fin >> inCode)
    {
      if(i < 1000)
        {
          if(inCode == 9999)
            {
              array[i] = inCode;
              i = 999;
            }
          else
            array[i] = inCode;
        }
      else
        {
          if(inCode == 9999)
            i = 1999;
          else
            array[i] = inCode;
        }
      i++;
    }


My code seems logical to me so I'm at loss as to what to fix
Last edited on
Because you are probably accessing out of bounds on your array. If you posted all of your code I might be able to help you more.
Topic archived. No new replies allowed.