Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct Node{
- int x;
- struct Node *next;
- };
- void wyswietl( struct Node *head ){
- while( head != NULL){
- printf("%d\n", head->x);
- head=head->next;
- }
- }
- int main(){
- struct Node *head;
- head = malloc(sizeof(struct Node));
- struct Node *tail;
- tail=head;
- for(int i=-20;i<21;i=i+5){
- struct Node *tmp;
- tmp = malloc(sizeof(struct Node));
- tmp->x = i;
- tail->next=tmp;
- tmp->next=NULL;
- tail=tmp;
- }
- wyswietl( head);
- free(head);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement