Скачиваний:
18
Добавлен:
01.05.2014
Размер:
564 б
Скачать
#include <stdio.h>
#include <stdlib.h>

#include "l2_malloc.h"

//#define NUM_BLOCKS 10


int main(int argc, char* argv[])
{
    int size_step = atoi(argv[1]);

    void* blocks[10];
    printf("Trying to allocate\n");
    
    int size = 0;
    for (int i=0; i<10; ++i)
    {
	size+=size_step;
	if ((blocks[i]=l2_malloc(size))==NULL)
	{
	    printf("Error while allocating memory.\n");
	    return -1;
	}
    }
    
    printf("Trying to free\n");
    for (int i=0; i<10; i++)
	l2_free(blocks[i]);
	
    printf("Test passed sucsessfuly.\n");
    
    return 0;
}
Соседние файлы в папке Лабораторная работа №2