esatto: usa, ad esempio, questo codice di prova
codice:#include <stdio.h> #include <stdlib.h> #define ITEM float typedef struct node { ITEM item ; struct node * next ; } Node; typedef Node * STACK ; int main(){ Node nodo, nodo2; nodo.item=0; nodo.next=NULL; nodo2.item=1; nodo2.next=&nodo; printf ("%d\n",count(&nodo2)); getchar(); return 1; } int count (STACK s){ int n = 0; for(; s!= NULL; s=s->next) n++; return n; }

Rispondi quotando