我到处都有语法错误,对 ADT 和内存处理的语法理解不好。next
我需要一个在and中引用自身(其他部分)的结构prev
。我做对了吗?我收到错误...
struct _header * header;
typedef struct _header {
int signiture;
int size;
header_t* next;
header_t* prev;
} header;
我还想用标头初始化内存中的前 32 个字节(这也不太顺利..):
//this is to reference the memory block later
static int *free_list_ptr;
void function(u_int32_t size){
memory = (byte*) malloc(size);
header firstHead = malloc(sizeof(_header));
free_list_ptr = firstHead = memory;
firstHead->prev = free_list_ptr;
firstHead->next = free_list_ptr;
}