If you are using an ANSI compliant compiler, malloc () returns a void pointer and since a void pointer can be assigned to a pointer variable of any object type, the (int *) cast shown above is not ...
the compiler will know how many bytes to copy into that memory location pointed to by ptr. If ptr was declared as pointing to an integer, 4 bytes would be copied. Similarly for floats and doubles the ...
I'm trying to make a point in my C++/data structures class about two-dimensional arrays being an array of one-dimensional arrays, so I thought I'd be clever and whip up the following quickie sample ...