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

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

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

?? 用c語言開發嵌入實時系統
?? 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 bgColor=white border=0 cellPadding=0 cellSpacing=0 width=511>
  <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 border=0 cellSpacing=0 width=521>
  <TBODY>
  <TR>
    <TD bgColor=white vAlign=center width="16%"><FONT 
      face="Times New Roman,Times">Modifier</FONT></TD>
    <TD bgColor=white vAlign=center width="84%"><FONT 
      face="Times New Roman,Times">Comment</FONT></TD></TR>
  <TR>
    <TD bgColor=white vAlign=center width="16%"><CODE>auto</CODE></TD>
    <TD bgColor=white vAlign=center width="84%"><FONT 
      face="Times New Roman,Times">automatic, allocated on the 
stack</FONT></TD></TR>
  <TR>
    <TD bgColor=white vAlign=center width="16%"><CODE>extern</CODE></TD>
    <TD bgColor=white vAlign=center width="84%"><FONT 
      face="Times New Roman,Times">defined in some other program</FONT> 
  file</TD></TR>
  <TR>
    <TD bgColor=white vAlign=center width="16%"><CODE>static</CODE></TD>
    <TD bgColor=white vAlign=center width="84%"><FONT 
      face="Times New Roman,Times">permanently allocated </FONT></TD></TR>
  <TR>
    <TD bgColor=white width="16%"><CODE>register</CODE></TD>
    <TD bgColor=white width="84%">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 border=0 cellSpacing=0 width=521>
  <TBODY>
  <TR>
    <TD bgColor=white vAlign=center width="16%"><FONT 
      face="Times New Roman,Times">Modifier</FONT></TD>
    <TD bgColor=white vAlign=center width="84%"><FONT 
      face="Times New Roman,Times">Comment</FONT></TD></TR>
  <TR>
    <TD bgColor=white vAlign=center width="16%"><CODE>volatile</CODE></TD>
    <TD bgColor=white vAlign=center width="84%"><FONT 
      face="Times New Roman,Times">can change value by means other than the 
      current program</FONT></TD></TR>
  <TR>
    <TD bgColor=white vAlign=center width="16%"><CODE>const</CODE></TD>
    <TD bgColor=white vAlign=center width="84%"><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 bgColor=white vAlign=center width="16%"><CODE>unsigned</CODE></TD>
    <TD bgColor=white vAlign=center width="84%"><FONT 
      face="Times New Roman,Times">range starts with 0 includes only positive 
      values</FONT></TD></TR>
  <TR>
    <TD bgColor=white vAlign=center width="16%"><CODE>signed</CODE></TD>
    <TD bgColor=white vAlign=center width="84%"><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一区二区三区免费野_久草精品视频
国产一区二区三区在线观看免费| 91福利在线免费观看| 99久久精品一区| 欧美一区二区三区免费大片| 中文字幕制服丝袜一区二区三区| 午夜视频在线观看一区| 国产宾馆实践打屁股91| 91精品国产福利在线观看| 中文字幕一区日韩精品欧美| 精一区二区三区| 精品视频一区二区不卡| 国产精品久久久久久久久久免费看| 亚洲成av人片一区二区三区| 99国产欧美另类久久久精品| 久久精品视频在线看| 美女脱光内衣内裤视频久久影院| 欧美专区在线观看一区| 中文字幕在线免费不卡| 国产精品中文字幕欧美| 日韩精品专区在线| 久久精品国产99国产| 7777精品伊人久久久大香线蕉超级流畅| 国产精品短视频| 99视频热这里只有精品免费| 国产精品网站在线播放| 国产91露脸合集magnet| 久久先锋影音av鲁色资源网| 久久69国产一区二区蜜臀| 欧美成人精品福利| 久久精品理论片| 精品国产乱码久久久久久夜甘婷婷 | 欧美性视频一区二区三区| 国产精品女人毛片| av在线播放成人| 国产亚洲成aⅴ人片在线观看| 国产一区二区福利视频| 国产亚洲女人久久久久毛片| 国产精品亚洲а∨天堂免在线| 久久―日本道色综合久久| 久久se精品一区二区| 久久综合九色综合欧美亚洲| 国产精品18久久久久久久久久久久 | 国产精品国产三级国产aⅴ原创| 成人三级在线视频| 亚洲欧洲日韩一区二区三区| 91福利社在线观看| 日本在线不卡视频| 精品国产一区二区精华| 日本欧美韩国一区三区| 欧美一区二区网站| 精品中文字幕一区二区| 久久精品亚洲乱码伦伦中文| 国产91对白在线观看九色| 国产精品国产精品国产专区不片| 99久久精品情趣| 午夜精品久久久久久久久久| 日韩欧美国产麻豆| 成人激情开心网| 亚洲午夜成aⅴ人片| 日韩视频免费观看高清完整版| 国内成+人亚洲+欧美+综合在线| 国产欧美1区2区3区| 91国在线观看| 久久国产精品第一页| 亚洲欧洲成人自拍| 日韩一区二区三区电影在线观看 | 国产91综合网| 国产精品视频你懂的| 成人久久视频在线观看| 粉嫩一区二区三区在线看| 一区二区三区精品视频在线| 丝袜美腿一区二区三区| 99re热这里只有精品免费视频| 7777精品久久久大香线蕉| 久久久精品一品道一区| 色哟哟在线观看一区二区三区| 青椒成人免费视频| 亚洲日本一区二区三区| 日韩欧美一级片| 成人美女视频在线看| 免费的成人av| 亚洲精品国产品国语在线app| 精品久久久久久综合日本欧美| 国产成人在线视频网站| 中文字幕av在线一区二区三区| 在线亚洲欧美专区二区| 高清国产一区二区| 奇米精品一区二区三区在线观看| 亚洲人吸女人奶水| 欧美极品aⅴ影院| 精品成人a区在线观看| 欧美曰成人黄网| 99精品国产热久久91蜜凸| 激情六月婷婷久久| 日本va欧美va瓶| 亚洲国产精品一区二区www在线| 中文字幕在线观看一区二区| 久久精品日产第一区二区三区高清版| 538在线一区二区精品国产| 成人午夜激情视频| 国产一区二区三区在线观看免费| 免费高清在线一区| 奇米色一区二区三区四区| 一区二区三区中文在线观看| 国产精品久久久久久久久图文区 | 国产精品一区二区你懂的| 美国十次综合导航| 蜜臀av在线播放一区二区三区| 亚洲成人一二三| 午夜精品影院在线观看| 亚洲高清中文字幕| 亚洲国产精品久久人人爱| 亚洲夂夂婷婷色拍ww47| 亚洲综合一区二区精品导航| 亚洲激情成人在线| 亚洲精品国产无天堂网2021| 亚洲一区二区美女| 午夜久久久久久久久 | 一区二区三区在线看| 日韩美女视频一区二区| 亚洲欧美偷拍三级| 亚洲欧美电影院| 夜夜嗨av一区二区三区| 亚洲综合在线视频| 天天综合网天天综合色| 麻豆精品久久久| 国产一区二区在线观看视频| 国产精品性做久久久久久| 高清国产一区二区| 色素色在线综合| 欧美日本一区二区| 91精品国产欧美一区二区18| 日韩亚洲欧美在线| 久久精品亚洲一区二区三区浴池| 国产精品免费aⅴ片在线观看| 成人免费在线观看入口| 亚洲一二三四区| 国产麻豆视频精品| 国产成人在线观看| 色婷婷久久一区二区三区麻豆| 在线电影院国产精品| 欧美xxxxxxxx| 日韩理论电影院| 午夜久久久久久电影| 国产黄人亚洲片| 在线视频你懂得一区| 7777精品伊人久久久大香线蕉最新版 | 久久97超碰国产精品超碰| 国产成人在线看| 欧美日韩亚洲另类| 久久伊人蜜桃av一区二区| 日韩理论片中文av| 同产精品九九九| caoporn国产精品| 欧美理论片在线| 国产农村妇女精品| 亚洲成人777| 懂色av一区二区在线播放| 欧美色图一区二区三区| 久久久久久久久久久黄色| 亚洲黄色av一区| 激情综合色综合久久| 一本到一区二区三区| 精品国产乱码久久久久久久 | 美女精品一区二区| 欧洲国内综合视频| 国产日韩欧美综合一区| 午夜亚洲国产au精品一区二区| 99久久99精品久久久久久| 欧美xxxxxxxxx| 亚洲mv在线观看| 色综合天天视频在线观看| 欧美精品一区男女天堂| 日日夜夜免费精品视频| 99久精品国产| 国产精品视频一二| 国产一区二区伦理| 欧美一级视频精品观看| 亚洲欧美另类久久久精品2019| 久久99国产精品免费| 欧美挠脚心视频网站| 亚洲乱码日产精品bd| 成人性生交大片| 久久久精品国产免大香伊| 日本伊人色综合网| 8x8x8国产精品| 亚洲1区2区3区视频| 欧洲精品一区二区| 一区二区三区四区在线| 99免费精品视频| 亚洲欧洲日韩综合一区二区| 国产91露脸合集magnet | 大桥未久av一区二区三区中文| 日韩欧美国产一区二区在线播放 | 精品国产一区二区三区久久影院| 日本美女视频一区二区| 7777精品伊人久久久大香线蕉经典版下载 | 亚洲欧洲av在线| 99免费精品在线观看| 亚洲男帅同性gay1069|