为什么这样初始化不行呢
1 #include <stdio.h>
2
3 typedef struct {
4 int price;
5 char name[10];
6 int atk;
7 } weapon_t;
8
9 int main(){
10 weapon_t a;
11 a.name="we";
12 a.price=33;
13 a.atk=99;
14 return 0;
15 }
#include <stdio.h>
typedef struct weapon{
    // 这个地方这么定义
    char *name;
    int atk;
    int price;
}weapon_t;
int main()
{
    weapon_t weapon1;
    
    weapon1.name="tom";
    weapon1.atk = 100;
    weapon1.price = 200;
    printf("%s %d %d\n",weapon1.name,weapon1.atk,weapon1.price);
    
    return 0;
}