Wednesday, December 1, 2010

The malloc() Function

The following compiles in C but not in C++:int *i = malloc(sizeof(int));

malloc() returns void*. C++ requires a cast to int*.

No comments:

Post a Comment