How do I use malloc and free?
Example char * string; string = (char*)malloc( _MAX_PATH ); if( string == NULL ) printf( “Insufficient memory available\n” ); else { printf( “Memory space allocated for path name\n” ); free( string ); printf( “Memory freed\n” ); } Faster example void *array; if ((array = malloc(length)) == NULL) exit(1);