Memory C

#include 
#include 
int main(void)
{
  char *p;
  long l;
  l = 0;
  do {
    p = malloc(1000);
    if(p) 
        l += 1000;
  } while(p);
  printf("Approximately %ld bytes of free memory.", l);
  return 0;
}