#include <stdio.h> struct weapon{ int price; int atk; struct weapon *next; }; void print_link_table(struct weapon *w) { printf("thie gun's attributes:\n"); printf(" price=%d\n",w->price); printf(" atk=%d\n",w->atk); if((w->next)==NULL) return; printf("print next gun'infomation:\n"); print_link_table(w->next); } int main() { struct weapon a,b,c,*head; a.price=100; a.atk=100; b.price=200; b.atk=200; c.price=300; c.atk=300; head=&a; a.next=&b; b.next=&c; c.next=NULL; print_link_table(head); return 0; }
看着应该是对的