title: SIGSEGV(signal 11) 'segmentation fault' in FCTRL2 codechef
body: <p>I am facing SIGSEGV error on submitting <a href="http://www.codechef.com/viewsolution/6379995" rel="nofollow">solution</a> for codechef small factorial problem code <strong><a href="http://www.codechef.com/problems/FCTRL2/" rel="nofollow">FCTRL2</a></strong> though the code works fine on <strong>ideone</strong>
  coding language <strong>C++ 4.3.2</strong>
  Example
  Sample input:
  4
  1
  2
  5
  3
  Sample output:
  1
  2
  120
  6</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  void fact(int n) {
      int m = 1, a[200];
      for (int j = 0; j &lt; 200; j++) {
          a[j] = 0;
      }
  
      a[0] = 1;
      for (int i = 1; i &lt;= n; i++) {
          int temp = 0;
          for (int j = 0; j &lt; m; j++) {
              a[j] = (a[j] * i) + temp;
              temp = a[j] / 10;
              a[j] %= 10;
              if (temp &gt; 0) {
                  m++;
              }
          }
  
      }
      if (a[m - 1] == 0) {
          m -= 1;
      }
      for (int l = m - 1; l &gt;= 0; l--) {
          cout &lt;&lt; a[l];
      }
  }
  
  int main() {
      int i;
      cin &gt;&gt; i;
      while (i--) {
          int n;
          cin &gt;&gt; n;
          fact(n);
          cout &lt;&lt; endl;
      }
      return 0;
  }
  </code></pre>