Witam,
Probuje wyswietlic liste jednokierunkowa, ale cos to nie dziala jak trzeba, moze ktos naprowidzi mnie w czym tkwi blad :)
#include <stdio.h>
#include <stdlib.h>
int main(){
struct node {
int data;
struct node *next;
};
struct node *mkNode(int val){
struct node *node = NULL;
if((node = malloc(sizeof (struct node))) != NULL){
node->data = val;
node->next = NULL;
}
return node;
}
struct node *a = mkNode(3);
struct node *b = mkNode(5);
a->next = b;
void printList(void){
struct node *tmp = a;
printf("(");
while(tmp != NULL){
printf(" %d", tmp->data);
tmp = tmp->next;
}
printf(" )\n");
}
return 0;
}