unsigned memavail(void) { char *ptr; unsigned size; size = maxavail(); if (size != 0) { if ((ptr=malloc((size_t)size)) != NULL) { size += memavail(); free(ptr); } } return size; }
main() { printf("Available DOS memory = %ld bytes\n", memavail()); return 0; }
void main() { printf( "%lu bytes of memory available\n", memavail() ); }