Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdlib.h>
- #include<stdio.h>
- struct list_el {
- int val;
- struct list_el * next;
- };
- typedef struct list_el item;
- void main() {
- item * curr, * head;
- item *last;
- int i;
- int input;
- head = NULL;
- int x=1;
- do{
- curr = (item *)malloc(sizeof(item));
- printf("Masukan Angka : ");
- scanf("%d",&input);fflush stdin;
- curr->val = input;
- curr->next = head;
- head = curr;
- system("cls");
- for(i=1,curr=head;curr!=NULL;i++){
- printf("%d", curr->val);
- curr = curr->next ;
- if(i!=x)
- printf(" -> ");
- }
- x++;
- printf("\n");
- }while(x!=10);
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment