C program to allocate memory

#include <stdlib.h>
#include <stdio.h>

int main()
{
long count=2;
char * mem;
while(1)
{
printf("allocated %ld bytes\n", count);
if((mem=(char *) malloc(count))== NULL) exit(1);
/*free(*mem); */
count*=2;
}
}

No comments:

Post a Comment

Should I trust AI

 Should I trust AI? So far no, sorry.  I tested for the moment (May, 2025) most advanced model for programming and ask very simple question:...