3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
[C/C++基礎]-雙層結構初始化 一般的C/C++講解結構(struct)大都只舉例一層的結構,但有時我們卻要使用多層的結構,因此今天和各位(C/P)程式同好介紹如何實現雙層結構初始化。 行號  程式  01020304050607080910111213141516171819 #include struct child{ int a; float b;};struct father{ int a; float b; child ch1;};//fa1={10,20.0f,{30,40.0}};main(){ father fa1={10,20.0f,{30,40.0}}; printf(“%d\t%f\n”,fa1.ch1.a,fa1.ch1.b); printf(“%d\t%f\n”,fa1.a,fa1.b);}    

本文由jashliaoeuwordpress提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦