void *malloc(size_t size)
void *calloc(size_t n, size_t size);
void free(void ptr*)
void *realloc (void *ptr, size_t size);
ptr = malloc(100*sizeof(int));
= ptr = realloc(NULL, 100*sizeof(int));
int block = 256;
ptr = malloc(block * sizeof(int));
...
block += block;
// Speicher für 512 int-Elemente reservieren
ptr = realloc(ptr, block*sizeof(int));
typedef struct data {
char name[MAX];
char vorname[MAX];
struct data *next;
}DATA;
DATA *first = NULL;
first = malloc (sizeof(DATA));
if (first!=NULL)
first->next = NULL;
DATA *help = NULL;
help = malloc (sizeof(DATA));
if (help!=NULL) {
help->next = NULL;
first->next = help;
}
akt->next = help->next;
help->next = akt;
akt->next = help->next;
free (help);
first
-Element an (global?)first
-Element erst beim Programmendefirst
-Element sind keine Datentypedef struct data {
char name[MAX_LEN];
char vorname[MAX_LEN];
struct data *next;
struct data *prev;
}DATA;
help = malloc (sizeof(DATA));
help->next = elem->next;
help->prev = elem;
elem->next->prev = help;
elem->next = help;
elem->prev->next=elem->next;
elem->next->prev = elem->prev;
free (elem);
akt=elem->next;
elem->next = akt->next; // oder: elem->next->next;
free(akt);
elem=malloc(sizeof(DATA));
elem->next = elem;
elem->pref = elem;
akt=malloc(sizeof(DATA));
akt->next=elem->next;
akt->prev=elem;
elem->next->prev = akt;
elem->next = akt;