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

📄 c-shell3.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<tr valign="top"><td colspan=1 rowspan=3><div class="CellBody"><a name="84841"> </a><b class="keyword">char</b></div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=3><div class="CellBodyC" align="center"><a name="84843"> </a>1</div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=3><pre class="CodeLeft"><b><a name="84845">x = 'A' x = (char)65 x = (char)0x41</a></b></pre></td><td width="10">&nbsp;</td><td colspan=1 rowspan=3><pre class="CodeLeft"><b><a name="84849">(char) x</a></b></pre></td><td width="10">&nbsp;</td></tr><tr valign="top"></tr><tr valign="top"></tr><tr valign="top"><td colspan=1 rowspan=4><div class="CellBody"><a name="84867"> </a><b class="keyword">double</b></div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=4><div class="CellBodyC" align="center"><a name="84869"> </a>8</div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=4><pre class="CodeLeft"><b><a name="84871">x = 11.2 x = (double)11.2</a></b></pre></td><td width="10">&nbsp;</td><td colspan=1 rowspan=4><pre class="CodeLeft"><b><a name="84874">(double) x</a></b></pre></td><td width="10">&nbsp;</td></tr><tr valign="top"></tr><tr valign="top"></tr><tr valign="top"></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84900"> </a><b class="keyword">float</b></div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="84902"> </a>4</div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><pre class="CodeLeft"><b><a name="84904">x = (float)5.42</a></b></pre></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><pre class="CodeLeft"><b><a name="84906">(float) x</a></b></pre></td><td width="10">&nbsp;</td></tr><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></p><dd><p class="Body"><a name="84908"> </a>Strings, or character arrays, are not treated as separate types in the shell C interpreter. To declare a string, set a variable to a string value.<sup><a href="#foot"><b class="FootnoteMarker">1</b></a></sup> For example:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84915"></b><tt class="output">-&gt;</tt><b> ss = "shoe bee doo"</a></b></pre></dl><dd><p class="Body"><a name="84916"> </a>The variable <b class="symbol_lc">ss</b> is a pointer to the string <i class="i">shoe bee doo</i>. To display <b class="symbol_lc">ss</b>, enter:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84917"></b><tt class="output">-&gt;</tt><b> d ss</a></b></pre></dl><dd><p class="Body"><a name="84926"> </a>The <b class="routine"><i class="routine">d</i></b><b>(</b>&nbsp;<b>)</b> command displays memory where <b class="symbol_lc">ss</b> is pointing.<sup><a href="#foot"><b class="FootnoteMarker">2</b></a></sup> You can also use <b class="routine"><i class="routine">printf</i></b><b>(&nbsp;)</b> to display strings.</p><dd><p class="Body"><a name="84931"> </a>The shell places no type restrictions on the application of operators. For example, the shell expression:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84932"> *(70000 + 3 * 16)</a></b></pre></dl><dd><p class="Body"><a name="84934"> </a>evaluates to the 4-byte integer value at memory location 70048.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84935">6.3.2  &nbsp;&nbsp;Lines and Statements</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84937"> </a>The shell parses and evaluates its input one line at a time. A line may consist of a single shell statement or several shell statements separated by semicolons. A semicolon is not required on a line containing only a single statement. A statement cannot continue on multiple lines. </p><dd><p class="Body"><a name="98477"> </a>Shell statements are either C expressions or assignment statements. Either kind of shell statement may call WindSh commands or target routines.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84939">6.3.3  &nbsp;&nbsp;Expressions</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84941"> </a>Shell expressions consist of literals, symbolic data references, function calls, and the usual C operators.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84942">Literals</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84947"> </a>The shell interprets the literals in <a href="c-shell3.html#84951">Table&nbsp;6-11</a> in the same way as the C compiler, with one addition: the shell also allows hex numbers to be preceded by <b>$</b> instead of <b>0x</b>.<p class="table"><h4 class="EntityTitle"><a name="84951"><font face="Helvetica, sans-serif" size="-1" class="sans">Table 6-11:&nbsp;&nbsp;Literals in the Shell C Interpreter</font></a></h4><table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84955"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Literal</font></b></div></th><td width="10">&nbsp;</td><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84957"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Example</font></b></div></th><td width="10">&nbsp;</td></tr><tr><td colspan="20"><hr class="tablerule2"></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84963"> </a>decimal numbers</div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="84965"> </a><b>143967</b> </div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84967"> </a>octal numbers</div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="84969"> </a><b>017734</b> </div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84971"> </a>hex numbers</div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="84973"> </a><b>0xf3ba</b> or <b>$f3ba</b> </div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84975"> </a>floating point numbers</div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="84977"> </a><b>666.666</b> </div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84979"> </a>character constants</div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="84981"> </a><b>'x'</b> and <b>'$'</b> </div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84983"> </a>string constants</div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="84985"> </a><b>"hello world!!!"</b> </div></td><td width="10">&nbsp;</td></tr><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><td colspan="20"></td>

⌨️ 快捷键说明

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