This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/clibexam/_heapset.c

28 lines
553 B
C
Raw Normal View History

#include <stdio.h>
#include <malloc.h>
void main()
{
int heap_status;
char *buffer;
buffer = (char *)malloc( 80 );
malloc( 1024 );
free( buffer );
heap_status = _heapset( 0xff );
switch( heap_status ) {
case _HEAPOK:
printf( "OK - heap is good\n" );
break;
case _HEAPEMPTY:
printf( "OK - heap is empty\n" );
break;
case _HEAPBADBEGIN:
printf( "ERROR - heap is damaged\n" );
break;
case _HEAPBADNODE:
printf( "ERROR - bad node in heap\n" );
break;
}
}