⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c55.htm

📁 经典c语言教程
💻 HTM
字号:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>结构嵌套 </title>
<script language="javascript">
   var prePage="http://www.nec.sjtu.edu.cn/support/Course/C/c/c5/c/c5/c54.htm";
   var nextPage="c/c5/c56.htm";
</script>

<link rel="stylesheet" href="../cstyle.css" type="text/css">
<bgsound src="../voice/c55.au" loop="1">
</head>

<body background="../img/mainback.jpg" bgproperties="fixed">

<h2 align="center"><font face="楷体_GB2312"><a name="_top"></a>5.5 结构嵌套</font></h2>

<hr>

<blockquote>
  <p>结构成员可以是任何简单数据类型, 例如 int, char, float, 
  等等。更进一步, 结构成员也可以是结构, 这叫做嵌套的结构。有时, 
  一个结构包含, 或 &quot;嵌套&quot; 另一个是比较方便的。</p>
  <p><br>
  struct date_and_time<br>
  {<br>
  &nbsp;&nbsp;&nbsp; struct date sdate;<br>
  &nbsp;&nbsp;&nbsp; struct time stime;<br>
  } event;<br>
  <br>
  struct date<br>
  { <br>
  &nbsp;&nbsp;&nbsp; int month;<br>
  &nbsp;&nbsp;&nbsp; int day;<br>
  &nbsp;&nbsp;&nbsp; int year;<br>
  }<br>
  <br>
  struct time<br>
  {<br>
  &nbsp;&nbsp;&nbsp; int hour;<br>
  &nbsp;&nbsp;&nbsp; int minute;<br>
  &nbsp;&nbsp;&nbsp; int second;<br>
  }<br>
  <br>
  <br>
  访问和操作一个指定成员: <br>
  (*) 用运算符 . 和成员名, 你可访问任何嵌套的结构成员。<br>
  (*) 例如: event.sdate.month=9; <br>
  (*) <a href="http://www.nec.sjtu.edu.cn/support/Course/C/c/c5/c51.htm">参阅 5.1 节</a></p>
  <p align="right"><a href="c55.htm#_top.html#_top">返回页首</a></p>
</blockquote>

<p align="center"><a href="http://www.nec.sjtu.edu.cn/support/Course/C/c/c5/c56.htm"><img src="../img/next.gif" width="145" height="30"
alt="next.gif (3633 bytes)" border="0"></a></p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -