The Way to Programming
The Way to Programming
I have to create a memory allocator with buddy algorithm. Can you help me please on how I can start program?
I did not do anything yes just initialize the variable and create the struct. If you can help me how to create the allocate method i would be great. The second part is the method which will be used to free. And because i am new in C and low knowledge with pointers i do not know exactly how i have to start.
#include <stdio.h> #include <stdlib.h> #define memory 4096 typedef struct buddy_list { struct buddy_list *left; struct buddy_list *right; int size; char st; }tree; void allocate () { } void free () { } int main() { tree *root; root = (tree *) malloc(sizeof(tree)); root -> size = 4096; root -> st = 'F'; printf ("size %d \nstatus is %c \n", root -> size, root->st); }
Sign in to your account