title: How to declare and use huge arrays of 1 billion integers in C?
body: <p>I'm implementing a sequential program for sorting like quicksort. I would like to test the performance of my program in a huge array of 1 or 10 billions of integers.
  But the problem is that I obtain a segmentation error due to the size of the array.</p>
  
  <p>A sample code of declaration of this array:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  #define N 1000000000
  
  int main(int argc, char **argv)
  {
    int list[N], i;
    srand(time(NULL));
    for(i=0; i&lt;N; i++)
       list[i] = rand()%1000;
    return 0;
  }
  </code></pre>
  
  <p>I got a proposition to use mmap function. But I don't know how to use it ? can anybody help me to use it ?</p>
  
  <p>I'm working on Ubuntu 10.04 64-bit, gcc version 4.4.3.</p>
  
  <p>Thanks for your replies. </p>