title: Memory allocation (calloc, malloc) for unsigned int
body: <p>For my C application I tried to initialize memory. I am aware of the slower calloc, but fortunatelly there is no need to track performance.</p>
  
  <p>I need memory space for just one unsigned int element (up to 65535).</p>
  
  <p>This is the part of my code that doesn't work:</p>
  
  <pre><code>//Declaration
  unsigned int part1;
  
  //Allocation
  part1 = (unsigned int) calloc (1,sizeof(unsigned int));
  </code></pre>
  
  <p>That throws the compiler warning:</p>
  
  <blockquote>
    <p>warning: cast from pointer to integer of different size
    [-Wpointer-to-int-cast]</p>
  </blockquote>
  
  <p>Why does the above code doesn't work, where...</p>
  
  <pre><code>unsigned long size;
  size =(unsigned long) calloc (1,sizeof(unsigned long));
  </code></pre>
  
  <p>...works great?</p>
  
  <p>Thank you!</p>