為什么可以在結構體里面聲明一個結構體指針呢
#include<stdio>
struct weapon {
? ? int price;
? ? int atk;
? ? struct weapon * next;
};
int main(){
? ? struct weapon a, b, c, *head
#include<stdio>
struct weapon {
? ? int price;
? ? int atk;
? ? struct weapon * next;
};
int main(){
? ? struct weapon a, b, c, *head
2016-10-17
舉報
2016-10-17
你把struct weapon *p你把它換成int *p,你看懂嗎?定義struct類型的地址,其實struct也是一種類型了,C語言中給出了另一種構造數據類型——“結構”,不能只有int啥的是類型,struct也是類型。
2017-01-05
因為這個指針指向的變量也是結構體類型的