title: Why am I getting segfault from this unsigned int?
body: <p>I'm trying to initialize an integer array and set all elements to 1. I need the array to have an upper bound of 4294967295, or the maximum number possible for a 32-bit <code>unsigned int</code>.</p>
  
  <p>This seems like a trivial task to me, and it should be, but I am running into <code>segfault</code>. I can run the <code>for</code> loop empty and it seems to work fine (albeit slowly, but it's processing nearly 4.3 billion numbers so I won't complain). The problem seems to show up when I try to perform any kind of action within the loop. The instruction I have below - <code>primeArray[i] = 1;</code> - causes the <code>segfault</code> error. As best as I can tell, this shouldn't cause me to overrun the array. If I comment out that line, no <code>segfault</code>.</p>
  
  <p>It's late and my tired eyes are probably just missing something simple, but I could use another pair.</p>
  
  <p>Here's what I've got:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;errno.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdint.h&gt;
  
  #define LIMIT 0xFFFFFFFF;
  
  int main(int argc, char const *argv[])
  {
      uint32_t i;
  
      uint32_t numberOfPrimes = LIMIT;        // hardcoded for debugging
      int *primeArray = (int*) malloc(numberOfPrimes * sizeof(int));
  
      for (i = 0; i &lt; numberOfPrimes; ++i) {
          primeArray[i] = 1;
      }
  }
  </code></pre>