HEAPCHK.C
上传用户:qq5388545
上传日期:2022-07-04
资源大小:29849k
文件大小:1k
- #include <stdio.h>
- #include <alloc.h>
- void main(void)
- {
- char *buffer, *second_buffer;
- int i, state;
- buffer = malloc(100);
- second_buffer = malloc(100);
- state = heapcheck();
- if (state == _HEAPOK)
- printf("Heap is okn");
- else if (state == _HEAPCORRUPT)
- printf("Heap is corruptn");
- for (i = 0; i <= 100; i++)
- buffer[i] = i;
- state = heapcheck();
- if (state == _HEAPOK)
- printf("Heap is okn");
- else if (state == _HEAPCORRUPT)
- printf("Heap is corruptn");
- }