📄 c12.htm
字号:
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<title>基本数据类型和常量</title>
<script language="javascript">
var prePage="c/c1/c11.htm";
var nextPage="c/c1/c13.htm";
function showwin(url, winname, properties){
window.open(url,winname,properties)
}
</script>
<link rel="stylesheet" href="../cstyle.css" type="text/css">
<bgsound src="../voice/c12.au" loop="1">
</head>
<body background="../img/mainback.jpg" bgproperties="fixed">
<h2 align="center"><font face="楷体_GB2312">1.2 <a name="_top"></a>基本数据类型和常量</font></h2>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" align="center"><a href="c12.htm#c121.html#c121">基本概念</a></td>
<td width="50%" align="center"><a href="c12.htm#c122.html#c122">练习题</a></td>
</tr>
</table>
<hr>
<h3><a name="c121"></a>1. 基本概念</h3>
<blockquote>
<p>不同的数据类型必须有不同的表示格式。</p>
<p>C的四种基本数据类型是: </p>
<div align="center"><center><table border="4" width="470" bgcolor="#CCFFFF"
bordercolor="#FF9933" cellspacing="0" cellpadding="0">
<tr>
<td width="109" align="center" bgcolor="#FF9933">类型</td>
<td width="87" align="center" bgcolor="#FF9933">长度(位)</td>
<td width="268" align="center" bgcolor="#FF9933">举例</td>
</tr>
<tr>
<td width="109" align="center">char </td>
<td width="87" align="center">8</td>
<td width="268" align="center">A 7 c * ^ ...</td>
</tr>
<tr>
<td width="109" align="center">int </td>
<td width="87" align="center">16</td>
<td width="268" align="center">125 -77 32500 0x1A 077 ...</td>
</tr>
<tr>
<td width="109" align="center">float</td>
<td width="87" align="center">32</td>
<td width="268" align="center">1.25 -0.89 .4e-4 7.69e20 ...</td>
</tr>
<tr>
<td width="109" align="center">double</td>
<td width="87" align="center">64</td>
<td width="268" align="center">1.25 -0.89 .4e-4 7.69e20 ...</td>
</tr>
</table>
</center></div><p>下面我们看一下变量的说明方法:<ul>
<li>整数变量: int int_var; long int l_int_var;</li>
<li>符型变量: char ch_var;</li>
<li>其它的例子: float f_var; double d_var;
short int s_int_var; <br>
unsigned int u_int_var;</li>
</ul>
<p>假定某个表达式仅包含 int, char, float , double 常量, 那么,
这种表达式被称作为常量表达式。</p>
</blockquote>
<blockquote>
<p align="right"><a href="c12.htm#_top.html#_top">返回页首</a></p>
</blockquote>
<hr>
<h3><a name="c122"></a>2.练习题</h3>
<blockquote>
<p><a
href="javascript:showwin('c12_21.htm',null,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width=600,height=500')">练习题一</a><img
src="../img/lefthand.gif" alt="lefthand.jpg (983 bytes)" WIDTH="45" HEIGHT="20"></p>
<p><a
href="javascript:showwin('c12_22.htm',null,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width=600,height=500')">练习题二</a><img
src="../img/lefthand.gif" alt="lefthand.jpg (983 bytes)" WIDTH="45" HEIGHT="20"></p>
<p><a
href="javascript:showwin('c12_23.htm',null,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width=600,height=500')">练习题三</a><img
src="../img/lefthand.gif" alt="lefthand.jpg (983 bytes)" WIDTH="45" HEIGHT="20"></p>
<p align="right"><a href="c12.htm#_top.html#_top">返回页首</a></p>
</blockquote>
<p align="center"><a href="http://www.nec.sjtu.edu.cn/support/Course/C/c/c1/c13.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 + -