title: Why is these code giving me an sigsegv error?
body: <p>Why is these code giving me a RUNTIME  SIGSEGV ERROR. I have tried running the code and works perfectly in codeblocks but some IDE is giving me these error.</p>
  
  <p>It takes a Fibonacci series then modulus each number in the series and only takes up the numbers at eve places till a single number is obtained.</p>
  
  <p>for example:input 1
                    9
  {0 1 1 2 3 5 8 13 21}->{0 1 1 2 3 5 8 3 1}->{1 2 5 3}->{2 3}->3</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void) {
      // your code goes here
      int n,j,k,r,o;
      o=0;
  
  
  //  printf("enter the number of test cases: ");
      scanf("%d",&amp;n);
      int s[n];
      int a;
      a=n;
  
      while(n!=0)
      {
  
  
           r=k;
           int e[k/2];
           int m;
           scanf("%d",&amp;k);//enter say 9
        if(k!=1)
              {
                int i[k];
                i[0]=0;
                i[1]=1;
  
                for(j=0;j&lt;k;j++)
                    {
                       if(j&gt;1)
                         {
                           i[j]=(i[j-2]+i[j-1])%10;
                         }
  
  
                    }
  
  
                while(r!=1)
                  {
                   m=0;
  
                   for(j=0;j&lt;r;j++)
                      {
  
                        if(j!=0)
                         {
  
                          if(j%2!=0)
                           {
                             e[m]=i[j];
                             m++;
                           }
                         }
                      }
  
                   for(j=0;j&lt;k/2;j++)
                      {
                        i[j]=e[j];
                      }
                   r=r/2;
                  }
               s[o]=e[0];
               o++;
               n--;
             }
          else
             {
               return 0;
             }
  
  
      }
      if(k!=1)
        {
          for(j=0;j&lt;a;j++)
           {
               printf("%d\n",s[j]);
           }
        }
  
  
      return 0;
  }
  </code></pre>
  
  <p>I want to know which point in the code is trigerring the error i know little about these error(like acessing array beyond bonds) can you explain me that?</p>