I wanted to used a loop that mallocs a memory block of some size and then prints the total amount of memory used until it malloc returns a 0 or until it stops and crashes. This is what I have so far:
Is this right?? Any help would be appreciated!!
Code:
int *allocated;
int n;
allocated = malloc(3 * sizeof(int));
for(n = 0; n < 3; n++);
{
printf ("%d\n", n);
}
free(allocated);
else
printf("0");
Is this right?? Any help would be appreciated!!