Since the array breaks up into a pointer in your case, you print the pointer (that is, on non-exotic computers, the memory address). There is no guarantee that the pointer matches int .
In the first part of the code, c and ca need not be equal. Your compiler does some memory optimization (see here for a complete answer).
In the second part, strdup dynamically selects a string twice, so the returned pointers are not equal. The compiler does not optimize these calls because it does not seem to control the definition of strdup .
In both cases, c and ca may not be equal.
source share