📄 c语言基础(10-字符数据类型和字符串).htm
字号:
</tr>
</table>
<table height=29 cellSpacing=1 cellPadding=0 width=760 background=/images1/bg_01.gif border=0>
<tr>
<td width=758 bgColor=#6179bf>
<P align=center>C语言基础(10-字符数据类型和字符串) </P></td>
</tr>
<tr>
<td width=757 height=20>
<P align=center>作者:dd 教程来源:C语言之家 点击数:209 更新时间:2006-6-6 <A title=收藏的网页将被永久地保存到新浪ViVi收藏夹http://vivi.sina.com.cn href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(vivi=window.open('http://vivi.sina.com.cn/collect/icollect.php?pid=2008&title='+escape(d.title)+'&url='+escape(d.location.href)+'&desc='+escape(t),'vivi','scrollbars=no,width=480,height=480,left=75,top=20,status=no,resizable=yes'));vivi.focus();"><IMG src="/images/vivi_coop1.gif" align=absMiddle border=0></A> </P></td>
</tr>
<tr>
<td style="BORDER-TOP-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-BOTTOM-STYLE: solid" borderColor=#7c8bc7 width=758 >
<div align="center">
<table cellpadding="0" cellspacing="0" width="96%" height="100%">
<!-- MSTableType="layout" -->
<tr>
<td height="17" valign="top">
<p align="left"><P class=MsoNormal><SPAN style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实型数在内存中的存放</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">――参见</SPAN><SPAN lang=EN-US>P46</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。因为实型数在内存中的存放形式比较复杂,它是按指数形式存于内存的。</SPAN></P>
<P class=MsoNormal><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">分为</SPAN><SPAN lang=EN-US>3</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">部分:符号;小数部分;指数部分。这一部分的知识要求有个了解就可以了,不必深究。</SPAN></P>
<P class=MsoNormal><SPAN style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">基本数据类型共有五种</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">:</SPAN><SPAN lang=EN-US>char</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>int</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>float</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>double</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>void </SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">各种数据类型(包括使用类型修饰符)的特点如下:</SPAN></P>
<DIV align=center>
<TABLE style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BACKGROUND: #0066ff; MARGIN-LEFT: -23.2pt; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt" cellSpacing=0 cellPadding=0 bgColor=#0066ff border=1>
<TBODY>
<TR>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 85.2pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid" vAlign=top width=114>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN style="COLOR: white; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类 型</SPAN><SPAN lang=EN-US style="COLOR: white"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 85.2pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt" vAlign=top width=114>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN style="COLOR: white; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">宽 度</SPAN><SPAN lang=EN-US style="COLOR: white"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 135.65pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt" vAlign=top width=181>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN style="COLOR: white; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表示数的范围</SPAN><SPAN lang=EN-US style="COLOR: white"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 81pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt" vAlign=top width=108>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN style="COLOR: white; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">说 明</SPAN><SPAN lang=EN-US style="COLOR: white"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 3cm; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt" vAlign=top width=113>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN style="COLOR: white; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">备 注</SPAN><SPAN lang=EN-US style="COLOR: white"><o:p></o:p></SPAN></P></TD></TR>
<TR>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 85.2pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=114>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US style="COLOR: white">char<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 85.2pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=114>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US style="COLOR: white">8<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 135.65pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=181>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US style="COLOR: white">-129~127<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 81pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=108>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN style="COLOR: white; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">字符型</SPAN><SPAN lang=EN-US style="COLOR: white"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 3cm; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=113>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN style="COLOR: white; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">基本数据类型</SPAN><SPAN lang=EN-US style="COLOR: white"><o:p></o:p></SPAN></P></TD></TR>
<TR>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 85.2pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=114>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US style="COLOR: white">unsigned<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 85.2pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=114>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US style="COLOR: white">8<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 135.65pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=181>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US style="COLOR: white">0~255<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 81pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=108>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN style="COLOR: white; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">无符号型</SPAN><SPAN lang=EN-US style="COLOR: white"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 3cm; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=113>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center> <SPAN lang=EN-US style="COLOR: white"><o:p></o:p></SPAN></P></TD></TR>
<TR style="HEIGHT: 7.5pt">
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 85.2pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 7.5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=114>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US style="COLOR: white">signed char<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 85.2pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 7.5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=114>
<P class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US style="COLOR: white">8<o:p></o:p></SPAN></P></TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -