#include using namespace std; //malloc() and realloc //starting with a fixed size, //increase size realloc() //simple_malloc_realloc1.cpp int main() { char buff[24];char * chptr1; cout<<"\n Enter a string less tha 24 char \n\t" ; gets(buff); //sanity check if(strlen(buff)>24){ cout<<"\n oops "; cout<<" lenth was "<< strlen(buff); exit(1);} chptr1 = (char*) malloc(strlen(buff)+1); //adding pointee strcpy(chptr1,buff); // if(chptr1==NULL){ cout<<"\n could not allocate "; free(chptr1);exit(1);} cout<<"\n allocated :\n\t "<