I know how to use new to dynamically allocate memory, but how can we use malloc() wich I think it's a C function?
Can you give me an example.Thanks...
I know how to use new to dynamically allocate memory, but how can we use malloc() wich I think it's a C function?
Can you give me an example.Thanks...
Here is one example of malloc() implementation.
Here is a reference website with information on malloc().Code:const int bufSize = 100; TCHAR *pDataBuf = NULL; pDataBuf = reinterpret_cast<TCHAR *>(malloc(bufSize + 1)); pDataBuf[bufSize] = '\0'; ... free(pDataBuf);
http://www.cplusplus.com/ref/cstdlib/malloc.html
Kuphryn
it frees the dynamically allocated memory,yeah,like delete does..So free is like delete?
actually new calls malloc and delete calls free.
/btq
...viewlexx - julie lexx