I have 2 questions about C programming:
For
int
anduint16_t
,long
anduint32_t
, and so on. When should I use theu*_t
types instead ofint
,long
, and so on? I found it confusing to choose which one is best for my program.When do I need to cast type? I have the following statement in my program:
long * src; long * dst; ... memcpy(dst, src, len);
My friend changes this to
memcpy((char *)dst, (char *)src, len).
This is just example I encountered. Generally, I am confused when cast is required?