Tuesday, October 20, 2009

I was trying to allocate memory dynamically in C using the C++ method of
char* ptr;
ptr=new char[len];

However the solution was

char* ptr=NULL;
ptr=(char*)mallock(len);

The latter actually worked. That was basically used to store the string temporarily just incase escape key was pressed to revert to original state.

Let me know of a better way.

No comments:

Post a Comment