title: When to use uint16_t vs int and when to cast type
body: <p>I have 2 questions about C programming:</p>
  
  <ol>
  <li><p>For <code>int</code> and <code>uint16_t</code>, <code>long</code> and <code>uint32_t</code>, and so on. When should I use the <code>u*_t</code> types instead of <code>int</code>, <code>long</code>, and so on? I found it confusing to choose which one is best for my program.</p></li>
  <li><p>When do I need to cast type?
  I have the following statement in my program: </p>
  
  <pre><code>long * src;
  long * dst;
  ...
  memcpy(dst, src, len); 
  </code></pre>
  
  <p>My friend changes this to </p>
  
  <pre><code>memcpy((char *)dst, (char *)src, len).
  </code></pre>
  
  <p>This is just example I encountered. Generally, I am confused when cast is required? </p></li>
  </ol>