正在加载图片...
2.相同类型的结构体变量可以进行整体赋值 struct date struct stud stl st2 st3 i int year st1.name=“John” int month; stl age= 20 int day i stl birthday year =1980 stl birthday month=11 struct stud i char name[10 stl. birthday day=23 st1. sI=89 int age struct date birthday; st1.s2=95 float s1. s2 st2=stI 注意要正确赋值的条件 st3.name=“Mary”; 是变量st1已经有了数据 st3. age=20; st3. birthday=stl birthday st3.s1=76 st3.s2=852. 相同类型的结构体变量可以进行整体赋值 struct date { int year ; int month ; int day ; } ; struct stud { char name[10] ; int age ; struct date birthday; float s1 , s2 ; } ; struct stud st1, st2, st3; st1. name = “John” ; st1. age = 20 ; st1. birthday.year = 1980 ; st1. birthday.month = 11 ; st1. birthday.day = 23 ; st1. s1 = 89 ; st1. s2 = 95 ; st2=st1; st3. name=“Mary”; st3. age=20; st3. birthday=st1. birthday; st3. s1 = 76; st3. s2 = 85; 注意要正确赋值的条件 是变量st1已经有了数据
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有