Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C Linked lists in QM
#3
OK for that.

so more code:


typedef struct node {
int val;
struct node * next;
} node_t;

type node int'val node*next

is there a way to have typedef like in code to define node_t? could not find it.....



The second problem is that C linked lists rely heavily on while/do while statements
But there are no "while" in QM, only rep.

void print_list(node_t * head) {
node_t * current = head;

while (current != NULL) {
printf("%d\n", current->val);
current = current->next;
}
}

i did:
#sub AfficherListe
function Liste*P <===no typedef
if(P==0) ret
Node* actuel=P.premier
rep
if(actuel==0)
break
out actuel.nombre
actuel=actuel.suivant

is this correct?


Messages In This Thread
C Linked lists in QM - by ldarrambide - 02-03-2019, 05:31 PM
RE: C Linked lists in QM - by Gintaras - 02-03-2019, 05:51 PM
RE: C Linked lists in QM - by ldarrambide - 02-03-2019, 06:07 PM
RE: C Linked lists in QM - by Gintaras - 02-03-2019, 06:31 PM
RE: C Linked lists in QM - by ldarrambide - 02-04-2019, 04:58 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)