Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct liste{
- int wert;
- struct liste *next
- };
- struct liste* NewListElem(int a){
- struct liste *test;
- if(test = (struct liste*) malloc(sizeof(struct liste))== 0){
- //printf("Fehler");
- exit(-1);
- }
- else {
- printf("Kein Fehler\n");
- }
- test->wert = a;
- test->next = NULL;
- //list -> wert = a;
- return test;
- }
- void AppendListElem(struct liste* list, int a){ //wie insert in Java
- struct liste *Next = list -> next;
- list -> next = NewListElem(a);
- list -> next -> next = Next;
- }
- int main(){
- struct liste *list = NewListElem(-1);
- int i = 0;
- i = (*list).wert;
- printf("%i", i);
- AppendListElem(list, 3);
- AppendListElem(list, 4);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement