为了账号安全,请及时绑定邮箱和手机立即绑定

我写的没问题吧

#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;
}


正在回答

1 回答

看着应该是对的

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Linux C语言结构体
  • 参与学习       118506    人
  • 解答问题       166    个

C语言的深入,帮助小伙伴们进一步的理解C语言,赶紧看过来

进入课程

我写的没问题吧

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号