亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? chapter 4 variables and constants -- valvano.htm

?? DevelopingEmbeddedSoftwareinC 嵌入式開發叢書 很不錯的
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
block. In C local variables must be defined at the beginning of a block. The 
following example is proper C++ code, but results in a syntax error in 
C.</FONT></P>
<DIR>
<P><CODE>void sub(void){ int x;&nbsp;&nbsp;/* a valid local variable declaration 
*/<BR>&nbsp;&nbsp;&nbsp;&nbsp;x=1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;int 
y;&nbsp;&nbsp;&nbsp;/* This declaration is improper 
*/<BR>&nbsp;&nbsp;&nbsp;&nbsp;y=2;<BR>}</CODE></P></DIR>
<ADDRESS>Listing 4-13: Example showing an illegal local variable 
declaration</ADDRESS>
<P>&nbsp;</P>
<P><B><I><FONT face=Helvetica,Arial><A 
name=DECLARATIONS></A>Declarations</FONT></I></B></P>
<P><FONT face="Times New Roman,Times">Unlike BASIC and FORTRAN, which will 
automatically declare variables when they are first used, every variable in C 
must be declared first. This may seem unnecessary, but when we consider how much 
time is spent debugging BASIC and FORTRAN programs simply because misspelled 
variable names are not caught for us, it becomes obvious that the time spent 
declaring variables beforehand is time well spent. Declarations also force us to 
consider the precision (8-bit, 16-bit etc.) and format (unsigned vs. signed) of 
each variable.</FONT></P>
<P><FONT face="Times New Roman,Times">As we saw in <A 
href="http://www.ece.utexas.edu/~valvano/embed/chap1/chap1.htm">Chapter 1</A>, 
describing a variable involves two actions. The first action is declaring its 
type and the second action is defining it in memory (reserving a place for it). 
Although both of these may be involved, we refer to the C construct that 
accomplishes them as a <I>declaration</I>. As we saw above, if the declaration 
is preceded by <B>extern</B> it only declares the type of the variables, without 
reserving space for them. In such cases, the definition must exist in another 
source file. Failure to do so, will result in an unresolved reference error at 
link time.</FONT></P>
<P><FONT face="Times New Roman,Times">Table 4-1 contains examples of legitimate 
variable declarations. Notice that the declarations are introduced by one or 
type keywords that states the data type of the variables listed. The keyword 
<B>char</B> declares 8-bit values, <B>int</B> declares 16-bit values, 
<B>short</B> declares 16-bit values and <B>long</B> declares 32-bit values. 
Unless the modifier <B>unsigned</B> is present, the variables declared by these 
statements are assumed by the compiler to contain signed values. You could add 
the keyword <B>signed</B> before the data type to clarify its type.</FONT></P>
<P><FONT face="Times New Roman,Times">When more than one variable is being 
declared, they are written as a list with the individual names separated by 
commas. Each declaration is terminated with a semicolon as are all simple C 
statements.</FONT></P>
<P><FONT face="Times New Roman,Times">
<TABLE cellSpacing=0 cellPadding=0 width=511 bgColor=white border=0>
  <TBODY>
  <TR>
    <TD><FONT face="Times New Roman,Times" size=2>Declaration</FONT></TD>
    <TD><FONT face="Times New Roman,Times" size=2>Comment</FONT></TD>
    <TD><FONT face="Times New Roman,Times" size=2>Range</FONT></TD></TR>
  <TR>
    <TD><CODE><FONT face="Times New Roman,Times">unsigned char 
      uc;</FONT></CODE></TD>
    <TD><FONT face="Times New Roman,Times" size=2>8-bit unsigned 
    number</FONT></TD>
    <TD><FONT face="Times New Roman,Times" size=2>0 to +255</FONT></TD></TR>
  <TR>
    <TD><CODE><FONT face="Times New Roman,Times">char 
    c1,c2,c3;</FONT></CODE></TD>
    <TD><FONT face="Times New Roman,Times" size=2>three 8-bit signed 
      numbers</FONT></TD>
    <TD><FONT face="Times New Roman,Times" size=2>-128 to +127</FONT></TD></TR>
  <TR>
    <TD><CODE><FONT face="Times New Roman,Times">unsigned int 
    ui;</FONT></CODE></TD>
    <TD><FONT face="Times New Roman,Times" size=2>16-bit unsigned 
    number</FONT></TD>
    <TD><FONT face="Times New Roman,Times" size=2>0 to +65535</FONT></TD></TR>
  <TR>
    <TD><CODE><FONT face="Times New Roman,Times">int i1,i2;</FONT></CODE></TD>
    <TD><FONT face="Times New Roman,Times" size=2>two 16-bit signed 
      numbers</FONT></TD>
    <TD><FONT face="Times New Roman,Times" size=2>-32768 to 
+32767</FONT></TD></TR>
  <TR>
    <TD><CODE><FONT face="Times New Roman,Times">unsigned short 
      us;</FONT></CODE></TD>
    <TD><FONT face="Times New Roman,Times" size=2>16-bit unsigned 
    number</FONT></TD>
    <TD><FONT face="Times New Roman,Times" size=2>0 to +65535</FONT></TD></TR>
  <TR>
    <TD><CODE><FONT face="Times New Roman,Times">short s1,s2;</FONT></CODE></TD>
    <TD><FONT face="Times New Roman,Times" size=2>two 16-bit signed 
      numbers</FONT></TD>
    <TD><FONT face="Times New Roman,Times" size=2>-32768 to 
+32767</FONT></TD></TR>
  <TR>
    <TD><CODE><FONT face="Times New Roman,Times">long 
      l1,l2,l3,l4;</FONT></CODE></TD>
    <TD><FONT face="Times New Roman,Times" size=2>four signed 32 bit 
      integers</FONT></TD>
    <TD><FONT face="Times New Roman,Times" size=2>-2147483648L to 
      2147483647L</FONT></TD></TR>
  <TR>
    <TD><CODE><FONT face="Times New Roman,Times">float f1,f2;</FONT></CODE></TD>
    <TD><FONT face="Times New Roman,Times" size=2>two 32-bit floating 
      numbers</FONT></TD>
    <TD>not recommended</TD></TR>
  <TR>
    <TD><CODE><FONT face="Times New Roman,Times">double 
d1,d2;</FONT></CODE></TD>
    <TD><FONT face="Times New Roman,Times" size=2>two 64-bit floating 
      numbers</FONT></TD>
    <TD>not recommended</TD></TR></TBODY></TABLE></FONT></P>
<ADDRESS>Table 4-1: Variable Declarations</ADDRESS>
<ADDRESS>&nbsp;</ADDRESS>
<P><FONT face="Times New Roman,Times">ICC11 version 4 does not support long 
integers, and ICC12 does not support unsigned long integers. ICC11 and ICC12 
compilers allow the <B>register</B> modifier for automatic variables, but the 
compilers still define the register locals on the stack. The keywords <B>char 
int short long</B> specifies the precision of the variable. The following tables 
shows the available modifiers for variables.</FONT></P>
<P>
<TABLE cellSpacing=0 width=521 border=0>
  <TBODY>
  <TR>
    <TD vAlign=center width="16%" bgColor=white><FONT 
      face="Times New Roman,Times">Modifier</FONT></TD>
    <TD vAlign=center width="84%" bgColor=white><FONT 
      face="Times New Roman,Times">Comment</FONT></TD></TR>
  <TR>
    <TD vAlign=center width="16%" bgColor=white><CODE>auto</CODE></TD>
    <TD vAlign=center width="84%" bgColor=white><FONT 
      face="Times New Roman,Times">automatic, allocated on the 
stack</FONT></TD></TR>
  <TR>
    <TD vAlign=center width="16%" bgColor=white><CODE>extern</CODE></TD>
    <TD vAlign=center width="84%" bgColor=white><FONT 
      face="Times New Roman,Times">defined in some other program</FONT> 
  file</TD></TR>
  <TR>
    <TD vAlign=center width="16%" bgColor=white><CODE>static</CODE></TD>
    <TD vAlign=center width="84%" bgColor=white><FONT 
      face="Times New Roman,Times">permanently allocated </FONT></TD></TR>
  <TR>
    <TD width="16%" bgColor=white><CODE>register</CODE></TD>
    <TD width="84%" bgColor=white>attempt to implement an automatic using a 
      register instead of on the stack</TD></TR></TBODY></TABLE></P>
<ADDRESS>Table 4-2: Variable storage classes</ADDRESS>
<ADDRESS>&nbsp;</ADDRESS>
<P>
<TABLE cellSpacing=0 width=521 border=0>
  <TBODY>
  <TR>
    <TD vAlign=center width="16%" bgColor=white><FONT 
      face="Times New Roman,Times">Modifier</FONT></TD>
    <TD vAlign=center width="84%" bgColor=white><FONT 
      face="Times New Roman,Times">Comment</FONT></TD></TR>
  <TR>
    <TD vAlign=center width="16%" bgColor=white><CODE>volatile</CODE></TD>
    <TD vAlign=center width="84%" bgColor=white><FONT 
      face="Times New Roman,Times">can change value by means other than the 
      current program</FONT></TD></TR>
  <TR>
    <TD vAlign=center width="16%" bgColor=white><CODE>const</CODE></TD>
    <TD vAlign=center width="84%" bgColor=white><FONT 
      face="Times New Roman,Times">fixed value, defined in the source code and 
      can not be changed during execution</FONT></TD></TR>
  <TR>
    <TD vAlign=center width="16%" bgColor=white><CODE>unsigned</CODE></TD>
    <TD vAlign=center width="84%" bgColor=white><FONT 
      face="Times New Roman,Times">range starts with 0 includes only positive 
      values</FONT></TD></TR>
  <TR>
    <TD vAlign=center width="16%" bgColor=white><CODE>signed</CODE></TD>
    <TD vAlign=center width="84%" bgColor=white><FONT 
      face="Times New Roman,Times">range includes both negative and positive 
      values</FONT></TD></TR></TBODY></TABLE></P>
<ADDRESS>Table 4-3 Variable modifiers</ADDRESS>
<P>&nbsp;</P>
<P><FONT face="Times New Roman,Times">As we shall see, a similar syntax is used 
to declare pointers, arrays, and functions (<A 
href="http://www.ece.utexas.edu/~valvano/embed/chap7/chap7.htm">Chapters 7</A>, 
<A href="http://www.ece.utexas.edu/~valvano/embed/chap8/chap8.htm">8</A>, and <A 
href="http://www.ece.utexas.edu/~valvano/embed/chap10/chap10.htm">10</A>).</FONT></P>
<P><B><I><FONT face=Helvetica,Arial><A name=CHARACTER></A>Character 
Variables</FONT></I></B></P>
<P><FONT face="Times New Roman,Times">Character variables are stored as 8-bit 
quantities. When they are fetched from memory, they are always promoted 
automatically to 16-bit integers. Unsigned 8-bit values are promoted by adding 8 
zeros into the most significant bits. Signed values are promoted by coping the 
sign bit (bit7) into the 8 most significant bits.</FONT></P>
<P><FONT face="Times New Roman,Times">There is a confusion when signed and 
unsigned variables are mixed into the same expression. It is good programming 
practice to avoid such confusions. As with integers, when a signed character 
enters into an operation with an unsigned quantity, the character is interpreted 
as though it was unsigned. The result of such operations is also unsigned. When 
a signed character joins with another signed quantity, the result is also 
signed.</FONT></P>
<DIR>
<P><CODE>char x;&nbsp;&nbsp;&nbsp;/* signed 8 bit global */<BR>unsigned short 
y;&nbsp;&nbsp;&nbsp;/* unsigned signed 16 bit global */<BR>void 
sub(void){<BR>&nbsp;&nbsp;&nbsp;&nbsp;y=y+x;<BR>/* x treated as unsigned even 
though defined as signed */<BR>}</CODE></P></DIR>
<ADDRESS>Listing 4-13: An example showing the mixture of signed and unsigned 
variables</ADDRESS>
<P><FONT face="Times New Roman,Times">There is also a need to change the size of 
characters when they are stored, since they are represented in the CPU as 16-bit 
values. In this case, however, it matters not whether they are signed or 
unsigned. Obviously there is only one reasonable way to put a 16-bit quantity 
into an 8-bit location. When the high-order byte is chopped off, an error might 
occur. It is the programmer's responsibility to ensure that significant bits are 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产人成综合网站| 亚洲一区影音先锋| 欧美日韩国产影片| 国产福利一区在线| 日本午夜精品视频在线观看| 国产精品国产三级国产普通话蜜臀 | 777奇米成人网| 成人99免费视频| 精品夜夜嗨av一区二区三区| 一个色妞综合视频在线观看| 国产日产精品1区| 精品日韩一区二区三区| 69精品人人人人| 在线观看一区二区视频| 99精品欧美一区二区三区综合在线| 久久成人av少妇免费| 日本亚洲一区二区| 亚洲成人av电影在线| 一区二区三区四区视频精品免费| 欧美国产成人在线| 国产日韩影视精品| 久久伊人蜜桃av一区二区| 884aa四虎影成人精品一区| 欧美午夜精品久久久久久孕妇| 97久久精品人人做人人爽| 成人听书哪个软件好| 国产成人午夜精品影院观看视频| 极品销魂美女一区二区三区| 热久久国产精品| 午夜欧美2019年伦理| 亚洲精品视频观看| 亚洲欧美国产三级| 亚洲激情中文1区| 一区二区三区四区视频精品免费 | 欧美综合视频在线观看| 色综合中文字幕| 色欧美片视频在线观看在线视频| 精品视频999| 日韩午夜av一区| 欧美日韩国产综合一区二区三区| 日本国产一区二区| 在线视频国产一区| 欧美少妇bbb| 欧美精品久久一区| 日韩色在线观看| 精品国产髙清在线看国产毛片 | 国产欧美一区二区三区在线老狼| 久久综合久久综合久久| 久久亚洲免费视频| 国产日产欧美一区| 亚洲欧洲制服丝袜| 亚洲国产va精品久久久不卡综合| 亚洲第一电影网| 日本aⅴ精品一区二区三区| 久久国产精品色婷婷| 国产呦萝稀缺另类资源| jlzzjlzz国产精品久久| 一本大道久久a久久精二百| 欧美老肥妇做.爰bbww视频| 日韩一区国产二区欧美三区| 久久蜜桃一区二区| 亚洲日本乱码在线观看| 亚洲va国产va欧美va观看| 精品一区二区三区久久| 成人免费精品视频| 欧美午夜一区二区三区| 日韩精品一区国产麻豆| 欧美国产激情一区二区三区蜜月| 亚洲欧洲制服丝袜| 日韩av一区二区在线影视| 国模少妇一区二区三区| 99久久免费精品| 91精品国产综合久久婷婷香蕉 | 久久久久久久免费视频了| 日韩视频免费观看高清完整版 | 亚洲成人动漫av| 韩国成人精品a∨在线观看| 成人高清伦理免费影院在线观看| 一本大道久久a久久精品综合| 91精品久久久久久久久99蜜臂| 久久久一区二区三区| 亚洲一二三区视频在线观看| 国产呦萝稀缺另类资源| 欧美私人免费视频| 中文字幕二三区不卡| 天堂在线亚洲视频| 不卡av免费在线观看| 日韩午夜三级在线| 一二三区精品福利视频| 国产精品亚洲成人| 欧美美女网站色| 中文字幕亚洲不卡| 久草精品在线观看| 欧美三级视频在线| 亚洲国产精品成人综合| 裸体健美xxxx欧美裸体表演| av不卡在线播放| 2014亚洲片线观看视频免费| 亚洲国产精品久久久久秋霞影院 | 欧美男人的天堂一二区| 国产精品色一区二区三区| 蜜臀久久久久久久| 91久久一区二区| 国产精品拍天天在线| 麻豆精品一区二区av白丝在线| 91啪九色porn原创视频在线观看| 精品久久国产老人久久综合| 婷婷成人激情在线网| 91女人视频在线观看| 欧美激情在线一区二区三区| 国内偷窥港台综合视频在线播放| 欧美日韩视频专区在线播放| 国产精品美日韩| 韩日精品视频一区| 精品国免费一区二区三区| 丝袜亚洲另类欧美综合| 欧美图区在线视频| 一区二区视频在线看| 成人短视频下载| 久久精品亚洲乱码伦伦中文| 精品一区精品二区高清| 欧美一级日韩免费不卡| 五月天久久比比资源色| 欧美日韩国产一级片| 亚洲v日本v欧美v久久精品| 欧美亚洲图片小说| 亚洲国产va精品久久久不卡综合| 色8久久人人97超碰香蕉987| 亚洲欧洲日韩综合一区二区| 成人亚洲精品久久久久软件| 久久精品无码一区二区三区| 国产电影一区在线| 日本一区二区三区高清不卡| 成人午夜视频在线| 国产精品久久久久影视| 成人小视频免费在线观看| 中文字幕高清不卡| 99久久久精品| 夜色激情一区二区| 欧美午夜精品久久久久久孕妇| 亚洲h动漫在线| 欧美日韩不卡视频| 美女视频黄免费的久久| 久久久国产综合精品女国产盗摄| 国产在线精品免费av| 亚洲国产精品二十页| 91在线国产观看| 夜夜操天天操亚洲| 欧美一级在线免费| 国产精品18久久久久久久网站| 国产三级一区二区三区| av在线播放一区二区三区| 一区二区免费看| 91精品免费在线| 国产一区二区三区四区五区美女| 国产欧美日韩中文久久| 日本精品一级二级| 日本强好片久久久久久aaa| 国产视频一区二区三区在线观看| 99精品视频一区二区三区| 亚洲一区日韩精品中文字幕| 欧美一级艳片视频免费观看| 国产成人av影院| 亚洲一区国产视频| 精品sm捆绑视频| 91麻豆高清视频| 日本人妖一区二区| 国产精品白丝在线| 91精品婷婷国产综合久久竹菊| 国产高清久久久| 亚洲一卡二卡三卡四卡无卡久久| 91精品在线麻豆| 懂色av一区二区夜夜嗨| 亚洲线精品一区二区三区| 日韩精品一区二区三区在线播放 | 欧亚洲嫩模精品一区三区| 蜜桃传媒麻豆第一区在线观看| 国产调教视频一区| 欧美日韩一级视频| 国产乱人伦偷精品视频不卡| 97精品视频在线观看自产线路二| 亚洲影院免费观看| 国产欧美精品一区二区色综合朱莉| 欧洲精品在线观看| 国产黄色成人av| 午夜精品影院在线观看| 国产精品麻豆视频| 欧美一级艳片视频免费观看| 91丨porny丨国产入口| 六月婷婷色综合| 亚洲一区二区免费视频| 国产精品天美传媒| 欧美电影精品一区二区| 色综合天天性综合| 国产精品99久久久久久久女警| 日韩精品乱码av一区二区| 亚洲视频资源在线| 久久久久久久久久久久久夜| 欧美一区二区私人影院日本| 色八戒一区二区三区|