{"id":70273,"date":"2026-02-01T18:49:15","date_gmt":"2026-02-01T10:49:15","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/70273.html"},"modified":"2026-02-01T18:49:15","modified_gmt":"2026-02-01T10:49:15","slug":"%e7%ae%97%e6%b3%95%e7%ab%9e%e8%b5%9bc-c%ef%bc%9a%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/70273.html","title":{"rendered":"\u7b97\u6cd5\u7ade\u8d5bC\/C++\uff1a\u6570\u636e\u7c7b\u578b"},"content":{"rendered":"<h2>Chapter 2&#xff1a;\u6570\u636e\u7c7b\u578b<\/h2>\n<\/p>\n<h3>\u4e00\u3001\u6570\u636e\u7c7b\u578b<\/h3>\n<p>\n\u7c7b\u578b&#xff0c;\u662f\u76f8\u4f3c\u7684\u6570\u636e\u6240\u636e\u62e5\u6709\u7684\u5171\u540c\u7279\u5f81<br \/>\nC&#043;&#043;\u5185\u7b80\u5355\u6570\u636e\u7c7b\u578b&#xff1a;\u5b57\u7b26\u578b&#xff0c;\u6574\u578b&#xff0c;\u6d6e\u70b9\u578b&#xff0c;\u5e03\u5c14\u7c7b\u578b<\/p>\n<h4>\n&#xff08;1&#xff09;.\u5b57\u7b26\u578b char\u00a0<\/h4>\n<p>\na.\u7528\u5355\u5f15\u53f7&#039;&#039;\u8868\u793a\u5b57\u7b26&#xff0c;\u7528\u53cc\u5f15\u53f7&#034;&#034;\u8868\u793a\u5b57\u7b26\u4e32<br \/>\nb.ASCII\u7f16\u7801<br \/>\n\u8ba1\u7b97\u673a\u4e2d\u6240\u6709\u6570\u636e&#xff08;\u5305\u62ec\u5b57\u7b26&#xff09;\u4ee5\u4e8c\u8fdb\u5236\u7684\u5f62\u5f0f\u5b58\u50a8&#xff0c;\u800cASCII\u7801\u8868\u4e2d\u8bb0\u5f55\u7684\u5c31\u662f\u6bcf\u4e2a\u5b57\u7b26\u7684\u5bf9\u5e94\u7f16\u7801&#xff08;128\u4e2a&#xff09;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260201104913-697f2fa99e72a.png\" \/><br \/>\n\u5176\u4e2d&#xff1a;<span style=\"color:#0d0016\">\u5b57\u7b26 A~Z \u7684ASCII\u7801\u503c\u4ece<\/span><span style=\"color:#fe2c24\"> 65~90<\/span><br \/>\n<span style=\"color:#0d0016\">\u00a0 \u00a0 \u00a0 \u5b57\u7b26 a~z \u7684ASCII\u7801\u503c\u4ece <\/span><span style=\"color:#fe2c24\">97~122<\/span><br \/>\n<span style=\"color:#0d0016\">\u00a0\u00a0 \u00a0 \u00a0\u5bf9\u5e94\u7684\u5927\u5c0f\u5199\u5b57\u7b26&#xff08;a\u548cA&#xff09;\u7684ASCII\u7801\u503c\u7684\u5dee\u503c\u4e3a <\/span><span style=\"color:#fe2c24\">32<\/span><br \/>\n\u00a0\u00a0 \u00a0 \u00a0<span style=\"color:#0d0016\">\u6570\u5b57\u5b57\u7b26 0~9 \u7684ASCII\u7801\u503c\u4ece <\/span><span style=\"color:#fe2c24\">48~57<\/span><br \/>\n\u00a0\u00a0 \u00a0 \u00a0\u6362\u884c \\\\n \u7684ASCII\u7801\u503c\u4e3a 10<br \/>\n\u00a0\u00a0 \u00a0 \u00a0ASCII\u7801\u503c\u4ece 0~31 \u8fd932\u4e2a\u5b57\u7b26\u4e3a\u4e0d\u53ef\u6253\u5370\u5b57\u7b26&#xff0c;\u65e0\u6cd5\u6253\u5370\u5728\u5c4f\u5e55\u4e0a\u89c2\u5bdf \u00a0<\/p>\n<p>\u4e3e\u4f8b1&#xff1a;\u7528ASCII\u7f16\u7801\u6253\u5370\u5bf9\u5e94\u5b57\u7b26<\/p>\n<p><span style=\"color:#fe2c24\">\u660e\u786e&#xff1a;\u4e00\u4e2a\u5b57\u7b26\u7684\u672c\u8d28\u5c31\u662f\u5b83\u7684ASCII\u7801\u503c\u00a0<\/span><\/p>\n<p>\/\/\u7528ASCII\u7f16\u7801\u6253\u5370\u5bf9\u5e94\u5b57\u7b26<br \/>\n#include &lt;iostream&gt;<\/p>\n<p>using namespace std;<\/p>\n<p>int main()<br \/>\n{<br \/>\n\u00a0\u00a0 \u00a0char n &#061; 65; \/\/A\u7684ASCII\u7f16\u7801\u4e3a 65\u00a0<br \/>\n\u00a0\u00a0 \u00a0cout &lt;&lt; n &lt;&lt; endl; \/\/\u5c4f\u5e55\u4e0a\u4f1a\u6253\u5370\u51fa A\u00a0<br \/>\n\u00a0\u00a0 \u00a0return 0;<br \/>\n}<\/p>\n<p>\u4e3e\u4f8b2&#xff1a;char\u7c7b\u578b\u53d8\u91cf\u53ea\u80fd\u63a5\u53d7<span style=\"color:#fe2c24\">\u5355\u4e2a<\/span>\u5b57\u7b26<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<\/p>\n<p>int main()<br \/>\n{<br \/>\n\u00a0\u00a0 \u00a0char n;<br \/>\n\u00a0\u00a0 \u00a0cin &gt;&gt; n; \/\/ \u8f93\u5165 65 &#xff0c;&#034;65&#034;\u5c5e\u4e8e\u4e24\u4e2a\u5b57\u7b26\u00a0<br \/>\n\u00a0\u00a0 \u00a0cout &lt;&lt; n &lt;&lt; endl; \/\/ \u8f93\u51fa 6 &#xff0c;\u800c\u4e0d\u662f\u8f93\u51fa ASCII\u7f16\u780165 \u5bf9\u5e94\u7684\u5b57\u7b26 A\u00a0<br \/>\n\u00a0\u00a0 \u00a0\/\/ \u56e0\u4e3a char\u7c7b\u578b \u53d8\u91cfn \u53ea\u80fd\u63a5\u53d7\u7b2c\u4e00\u4e2a\u5b57\u7b26 &#039;6&#039;,\u6240\u4ee5\u8f93\u51fa\u7ed3\u679c\u4e3a 6\u00a0<br \/>\n\u00a0\u00a0 \u00a0return 0;<br \/>\n}<\/p>\n<p>\u4e3e\u4f8b3&#xff1a;\u8f93\u5165\u6570\u5b57 65 \u5f97\u5230\u5b57\u7b26 &#039;A&#039;&#xff0c;\u9700\u5c06\u53d8\u91cf\u6539\u4e3a<font face=\"monospace\">int<\/font>\u63a5\u6536\u6570\u5b57&#xff0c;\u518d<span style=\"color:#ff9900\">\u5f3a\u5236\u8f6c\u6362<\/span>\u4e3achar<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std; \u00a0 \/\/standard\u6807\u51c6\u00a0\u00a0<\/p>\n<p>int main()<br \/>\n{<br \/>\n\u00a0\u00a0 \u00a0int n;<br \/>\n\u00a0\u00a0 \u00a0cin &gt;&gt; n; \/\/ \u8f93\u5165 \u5b57\u7b26A \u7684 ASCII\u7f16\u780165 \u5e76\u7528 int\u7c7b\u578b\u5b58\u50a8\u00a0<br \/>\n\u00a0\u00a0 \u00a0char m &#061; (char)n; \/\/\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u00a0<br \/>\n\u00a0\u00a0 \u00a0cout &lt;&lt; m &lt;&lt; endl; \/\/ \u8f93\u51fa\u5b57\u7b26A\u00a0<br \/>\n\u00a0\u00a0 \u00a0return 0;<br \/>\n}<\/p>\n<p>\/\/endl \u662f\u8f93\u51fa\u6d41\u7684\u64cd\u4f5c\u7b26&#xff0c;\u53ea\u80fd\u7528\u5728 cout \u540e\u9762&#xff0c;\u4e0d\u80fd\u7528 cin \u540e\u9762\u00a0<\/p>\n<h4>\n&#xff08;2&#xff09;.\u6574\u578b\u7c7b\u578b&#xff08;\u6574\u6570&#xff09;<\/h4>\n<p>\u00a0<br \/>\n\u5728 C\u548cC&#043;&#043; \u4e2d\u88ab\u5206\u4e3a\u56db\u5927\u7c7b<br \/>\nshort \u77ed\u6574\u578b\u00a0<br \/>\nint \u6574\u578b\u00a0<br \/>\nlong \u957f\u6574\u578b\u00a0<br \/>\nlong long \u00a0\u66f4\u957f\u7684\u6574\u578b\u00a0<\/p>\n<p>#include &lt;iostream&gt;<br \/>\n#include &lt;climits&gt; \/\/ \u5305\u542b\u6574\u578b\u8303\u56f4\u7684\u5e38\u91cf\u5b9a\u4e49<br \/>\nusing namespace std;<\/p>\n<p>int main() {<br \/>\n\u00a0 \u00a0 \/\/ 1. \u67e5\u770b\u5404\u6574\u578b\u5360\u7528\u7684\u5b57\u8282\u6570&#xff08;\u5185\u5b58\u5927\u5c0f&#xff09;<br \/>\n\u00a0 \u00a0 cout &lt;&lt; &#034;short \u5360\u7528\u5b57\u8282\u6570&#xff1a;&#034; &lt;&lt; sizeof(short) &lt;&lt; endl;<br \/>\n\u00a0 \u00a0 cout &lt;&lt; &#034;int \u00a0 \u5360\u7528\u5b57\u8282\u6570&#xff1a;&#034; &lt;&lt; sizeof(int) &lt;&lt; endl;<br \/>\n\u00a0 \u00a0 cout &lt;&lt; &#034;long \u00a0\u5360\u7528\u5b57\u8282\u6570&#xff1a;&#034; &lt;&lt; sizeof(long) &lt;&lt; endl;<br \/>\n\u00a0 \u00a0 cout &lt;&lt; &#034;long long \u5360\u7528\u5b57\u8282\u6570&#xff1a;&#034; &lt;&lt; sizeof(long long) &lt;&lt; endl;<\/p>\n<p>\u00a0 \u00a0 \/\/ 2. \u67e5\u770b\u5404\u6574\u578b\u7684\u6570\u503c\u8303\u56f4<br \/>\n\u00a0 \u00a0 cout &lt;&lt; &#034;short \u8303\u56f4&#xff1a;&#034; &lt;&lt; SHRT_MIN &lt;&lt; &#034; ~ &#034; &lt;&lt; SHRT_MAX &lt;&lt; endl;<br \/>\n\u00a0 \u00a0 cout &lt;&lt; &#034;int \u00a0 \u8303\u56f4&#xff1a;&#034; &lt;&lt; INT_MIN &lt;&lt; &#034; ~ &#034; &lt;&lt; INT_MAX &lt;&lt; endl;<br \/>\n\u00a0 \u00a0 cout &lt;&lt; &#034;long \u00a0\u8303\u56f4&#xff1a;&#034; &lt;&lt; LONG_MIN &lt;&lt; &#034; ~ &#034; &lt;&lt; LONG_MAX &lt;&lt; endl;<br \/>\n\u00a0 \u00a0 cout &lt;&lt; &#034;long long \u8303\u56f4&#xff1a;&#034; &lt;&lt; LLONG_MIN &lt;&lt; &#034; ~ &#034; &lt;&lt; LLONG_MAX &lt;&lt; endl;<\/p>\n<p>\u00a0 \u00a0 return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260201104914-697f2faa29e6a.png\" \/><\/p>\n<p>C\/C&#043;&#043; \u7684\u6807\u51c6\u89c4\u5b9a&#xff1a;sizeof(long) &gt;&#061; sizeof(int)<\/p>\n<p>\u6240\u4ee5sizeof(long) \u7684\u8ba1\u7b97\u7ed3\u679c\u53ef\u80fd\u662f\u00a04\u62168&#xff0c;\u53d6\u51b3\u4e8e\u7f16\u8bd1\u5668<\/p>\n<h4>&#xff08;3&#xff09;.\u6d6e\u70b9\u578b&#xff08;\u5c0f\u6570&#xff09;\u00a0<\/h4>\n<p>\u5728 C\u548cC&#043;&#043; \u4e2d\u88ab\u5206\u4e3a\u4e09\u5927\u7c7b&#xff1a;<br \/>\nfloat \u5355\u7cbe\u5ea6\u6d6e\u70b9\u578b\u00a0<br \/>\ndouble \u53cc\u7cbe\u5ea6\u6d6e\u70b9\u578b\u00a0<br \/>\nlong double \u00a0\u957f\u53cc\u7cbe\u5ea6\u6d6e\u70b9\u578b\u00a0<\/p>\n<p>flodt num &#061; 5.5;\u00a0 \u00a0 \/\/ 5.5 \u4f1a\u88ab\u7f16\u8bd1\u5668<span style=\"color:#fe2c24\">\u8bc6\u522b\u4e3a double<\/span>\u7c7b\u578b<br \/>\nfloat num &#061; 5.5<span style=\"color:#fe2c24\">f<\/span>;\u00a0 \u00a0\/\/ 5.5 \u4f1a\u88ab\u7f16\u8bd1\u5668<span style=\"color:#fe2c24\">\u8bc6\u522b\u4e3a float<\/span>\u7c7b\u578b<\/p>\n<p>C\/C&#043;&#043;\u4e2d\u5c0f\u6570\u4e66\u5199\u5f62\u5f0f&#xff1a;<br \/>\n3.14\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u7f16\u8bd1\u5668\u9ed8\u8ba4\u8bc6\u522b\u4e3a double\u7c7b\u578b<br \/>\n3.14f\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u7f16\u8bd1\u5668\u9ed8\u8ba4\u8bc6\u522b\u4e3a float\u7c7b\u578b<br \/>\n1e5\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u79d1\u5b66\u8ba1\u6570\u6cd5\u8868\u793a\u5f62\u5f0f&#xff0c;\u88681.0*10^5<br \/>\n1e5&#043;10\u00a0 \u00a0 \u00a0 \u00a0 100010<br \/>\n1.23e5&#043;10\u00a0 \u00a0123010<\/p>\n<h4>&#xff08;4&#xff09;.\u5e03\u5c14\u7c7b\u578b&#xff08;bool&#xff09;<\/h4>\n<p>\n\u5e03\u5c14\u7c7b\u578b\u53d8\u91cf\u7684\u503c\u4e3a true \u6216 false&#xff0c;\u7528\u4e8e\u8868\u793a\u771f\u6216\u5047<br \/>\n\u5728C\/C&#043;&#043;\u4e2d&#xff0c;0\u8868\u793a\u5047&#xff0c;\u975e0\u8868\u793a\u771f<\/p>\n<p>bool flag &#061; true;<\/p>\n<h3 style=\"background-color:transparent\">\u4e8c\u3001signed \u548c unsigned<\/h3>\n<\/p>\n<p>signed&#xff08;\u6709\u7b26\u53f7\u7684&#xff09; \u548c unsigned&#xff08;\u65e0\u7b26\u53f7\u7684&#xff09; \u5173\u952e\u5b57\u7528\u4e8e\u4fee\u9970\u5b57\u7b26\u578b\u548c\u6574\u578b\u7c7b\u578b<\/p>\n<p>signed \u8868\u793a\u4e00\u4e2a\u7c7b\u578b\u5e26\u6709\u6b63\u8d1f\u53f7&#xff0c;\u5305\u542b\u8d1f\u503c<br \/>\nunsigned \u8868\u793a\u4e00\u4e2a\u7c7b\u578b\u4e0d\u5e26\u6709\u6b63\u8d1f\u53f7&#xff0c;\u53ea\u80fd\u8868\u793a0\u548c\u6b63\u6574\u6570<\/p>\n<p>int n;<br \/>\nsigned int n;<br \/>\nunsigned int n;<\/p>\n<p>\u5bf9\u4e8e <span style=\"color:#fe2c24\">\u6574\u578b\u7c7b\u578b<\/span> \u9ed8\u8ba4\u5e26\u6709\u6b63\u8d1f\u53f7&#xff0c;\u5176signed\u53ef\u4ee5\u7701\u7565&#xff0c;\u5982 int &#061;&#061; signed int<br \/>\n\u4f46\u662f <span style=\"color:#fe2c24\">char\u7c7b\u578b<\/span> \u7684\u7b26\u53f7\u6027\u53d6\u51b3\u4e8e\u7f16\u8bd1\u5668&#xff0c;\u5373 char \u4e0d\u4e00\u5b9a\u7b49\u4e8e signed char<br \/>\n\u5e38\u89c1\u7f16\u8bd1\u5668\u4e2d&#xff0c;char &#061;&#061; signed char\u00a0<\/p>\n<p>\u5c06\u53d8\u91cf\u58f0\u660e\u4e3a <span style=\"color:#fe2c24\">unsigned<\/span>&#xff0c;\u540c\u6837\u957f\u5ea6\u7684\u5185\u5b58\u80fd\u591f\u8868\u793a\u7684\u6700\u5927\u6574\u6570\u503c <span style=\"color:#fe2c24\">\u589e\u5927\u4e00\u500d<\/span>\u00a0<\/p>\n<\/p>\n<p>\/\/\u6ce8\u610f unsigned\u7684\u4f7f\u7528 \u5bf9\u8f93\u5165\u6570\u636e\u7684\u5b58\u50a8\u9020\u6210\u7684\u5f71\u54cd<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<\/p>\n<p>int main()<br \/>\n{<br \/>\n\u00a0\u00a0 \u00a0unsigned int num &#061; 10;<br \/>\n\u00a0\u00a0 \u00a0cout &lt;&lt; num &lt;&lt; endl; \/\/\u8f93\u51fa10\u00a0<br \/>\n\u00a0\u00a0 \u00a0cin &gt;&gt; num; \/\/\u8f93\u5165 -5\u00a0<br \/>\n\u00a0\u00a0 \u00a0cout &lt;&lt; num &lt;&lt; endl; \/\/\u8f93\u51fa4294967291<br \/>\n\u00a0\u00a0 \u00a0return 0;<br \/>\n\u00a0}<\/p>\n<p>\u00a0<\/p>\n<h3>\u4e09\u3001\u6570\u636e\u7c7b\u578b\u957f\u5ea6<\/h3>\n<h4>\n&#xff08;1&#xff09;. sizeof \u64cd\u4f5c\u7b26<\/h4>\n<p>\nsizeof \u662f\u4e00\u4e2a\u5173\u952e\u5b57&#xff0c;\u4e5f\u662f\u64cd\u4f5c\u7b26&#xff0c;\u4e13\u95e8\u7528\u4e8e\u8ba1\u7b97\u7279\u5b9a\u6570\u636e\u7c7b\u578b\u7684\u957f\u5ea6&#xff0c;\u5355\u4f4d\u662f<span style=\"color:#fe2c24\">\u5b57\u8282<\/span><br \/>\nsizeof\u64cd\u4f5c\u7b26\u7684 \u64cd\u4f5c\u6570\u53ef\u4ee5\u662f\u7c7b\u578b&#xff0c;\u4e5f\u53ef\u4ee5\u662f\u53d8\u91cf\u540d\u6216\u8868\u8fbe\u5f0f<\/p>\n<p>\u7528\u6cd5&#xff1a;sizeof&#xff08;\u64cd\u4f5c\u6570&#xff09;\u00a0<\/p>\n<p>\u5f53\u64cd\u4f5c\u6570\u4e0d\u662f\u7c7b\u578b&#xff0c;\u62ec\u53f7\u53ef\u4ee5\u7701\u7565\u00a0<\/p>\n<p>\n\u5176\u8ba1\u7b97\u7ed3\u679c\u4e3a size_t \u7c7b\u578b&#xff0c;\u4e3a\u65e0\u7b26\u53f7\u6574\u6570\u00a0<\/p>\n<p>sizeof(char) &#8211;&gt; 1\u5b57\u8282\u00a0<br \/>\nsizeof(bool) &#8211;&gt; 1\u5b57\u8282\u00a0\u00a0<br \/>\nsizeof(float) &#8211;&gt; 4\u5b57\u8282\u00a0<br \/>\nsizeof(double) &#8211;&gt; 8\u5b57\u8282\u00a0<br \/>\nsizeof(long double) &#8211;&gt; 16\u5b57\u8282<\/p>\n<p>\u6570\u636e\u7c7b\u578b\u7684\u957f\u5ea6\u51b3\u5b9a\u4e86 \u7531\u8fd9\u4e2a\u6570\u636e\u7c7b\u578b\u5b9a\u4e49\u51fa\u6765\u7684\u53d8\u91cf\u80fd\u591f\u5b58\u50a8\u7684\u6570\u503c\u7684\u5927\u5c0f<\/p>\n<h4>&#xff08;2&#xff09;.<span style=\"color:#fe2c24\">\u5404\u7c7b\u578b\u53d6\u503c\u8303\u56f4&#xff08;\u91cd\u8981&#xff09;<\/span><\/h4>\n<p><span style=\"color:#333333\">\u6574\u578b\u7c7b\u578b&#xff1a;<\/span><\/p>\n<table align=\"left\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:650px\">\n<tbody>\n<tr>\n<td>\u7c7b\u578b<\/td>\n<td>\u540d\u79f0<\/td>\n<td>\u5185\u5b58\u5360\u7528<\/td>\n<td>\u6570\u503c\u8303\u56f4&#xff08;\u4ee5\u5e38\u89c1\u7684 64 \u4f4d\u7cfb\u7edf\u4e3a\u4f8b&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>short<\/td>\n<td>\u77ed\u6574\u578b<\/td>\n<td>2\u5b57\u8282<\/td>\n<td>-2\u00b9\u2075 ~ 2\u00b9\u2075 -1&#xff08;\u5927\u7ea6\u4e3a\u00b110\u2074&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>int<\/td>\n<td>\u6574\u578b<\/td>\n<td>4\u5b57\u8282<\/td>\n<td>-2\u00b3\u00b9 ~ 2\u00b3\u00b9 -1&#xff08;\u5927\u7ea6\u4e3a\u00b110\u2079&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>unsigned int<\/td>\n<td>\u65e0\u7b26\u53f7\u6574\u578b<\/td>\n<td>4\u5b57\u8282<\/td>\n<td>0 ~ 2\u00b3\u00b2 -1<\/td>\n<\/tr>\n<tr>\n<td>long<\/td>\n<td>\u957f\u6574\u578b<\/td>\n<td>4\/8\u5b57\u8282<\/td>\n<td>-2\u00b3\u00b9 ~ 2\u00b3\u00b9 -1&#xff08;\u5927\u7ea6\u4e3a\u00b110\u2079&#xff09;\u00a0\/ -2\u2076\u00b3 ~ 2\u2076\u00b3 -1&#xff08;\u5927\u7ea6\u4e3a\u00b110\u00b9\u2078&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>long long<\/td>\n<td>\u66f4\u957f\u7684\u6574\u578b<\/td>\n<td>8\u5b57\u8282<\/td>\n<td>\n<p>-2\u2076\u00b3 ~ 2\u2076\u00b3 -1&#xff08;\u5927\u7ea6\u4e3a\u00b110\u00b9\u2078&#xff09;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><\/h4>\n<h4><\/h4>\n<h4><\/h4>\n<h4><\/h4>\n<h4><\/h4>\n<h4><\/h4>\n<p>C\/C&#043;&#043; \u7684\u6807\u51c6\u89c4\u5b9a&#xff1a;sizeof(long) &gt;&#061; sizeof(int)<\/p>\n<p>\u6240\u4ee5sizeof(long) \u7684\u8ba1\u7b97\u7ed3\u679c\u53ef\u80fd\u662f\u00a04\u62168&#xff0c;\u53d6\u51b3\u4e8e\u7f16\u8bd1\u5668<\/p>\n<p>\u6d6e\u70b9\u6570\u7c7b\u578b&#xff1a;<\/p>\n<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:700px\">\n<tbody>\n<tr>\n<td style=\"width:90px\">\u7c7b\u578b<\/td>\n<td style=\"width:120px\">\u540d\u79f0<\/td>\n<td style=\"width:77px\">\u5185\u5b58\u5360\u7528<\/td>\n<td>\u6570\u503c\u8303\u56f4&#xff08;\u4ee5\u5e38\u89c1\u7684 64 \u4f4d\u7cfb\u7edf\u4e3a\u4f8b&#xff09;<\/td>\n<\/tr>\n<tr>\n<td style=\"width:90px\">float<\/td>\n<td style=\"width:120px\">\u5355\u7cbe\u5ea6\u6d6e\u70b9\u578b<\/td>\n<td style=\"width:77px\">4\u5b57\u8282<\/td>\n<td>\n<p>\u7cbe\u5ea6&#xff1a;6~7 \u4f4d<\/p>\n<p>\u6709\u6548\u6570\u5b57\u8303\u56f4&#xff1a;\u00b110\u207b\u00b3\u2078\u00a0~ \u00b110\u00b3\u2078<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width:90px\"><span style=\"color:#fe2c24\">double<\/span><\/td>\n<td style=\"width:120px\">\u53cc\u7cbe\u5ea6\u6d6e\u70b9\u578b<\/td>\n<td style=\"width:77px\">8\u5b57\u8282<\/td>\n<td>\n<p>\u7cbe\u5ea6&#xff1a;15~17 \u4f4d<\/p>\n<p>\u6709\u6548\u6570\u5b57\u8303\u56f4&#xff1a;\u00b110\u207b\u00b3\u2070\u2078~ \u00b110\u00b3\u2070\u2078<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width:90px\">long double<\/td>\n<td style=\"width:120px\">\u957f\u53cc\u7cbe\u5ea6\u6d6e\u70b9\u578b<\/td>\n<td style=\"width:77px\">8\/16\u5b57\u8282<\/td>\n<td>\n<p>\u7cbe\u5ea6&#xff1a;\u81f3\u5c11 15 \u4f4d\u6709\u6548\u6570\u5b57&#xff08;16 \u5b57\u8282\u7248\u672c\u53ef\u8fbe 18~19 \u4f4d&#xff09;<\/p>\n<p>\u8303\u56f4&#xff1a;\u00b110\u207b\u2074\u2079\u00b3\u00b2 ~ \u00b110\u2074\u2079\u00b3\u00b2&#xff08;16 \u5b57\u8282\u7248\u672c&#xff09;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li>\n<p>\u201c\u6709\u6548\u6570\u5b57\u201d \u662f\u6838\u5fc3&#xff1a;\u6d6e\u70b9\u6570\u7684 \u201c\u7cbe\u5ea6\u201d \u4e0d\u662f \u201c\u5c0f\u6570\u4f4d\u6570\u201d&#xff0c;\u800c\u662f\u5168\u90e8\u6570\u5b57\u7684\u4f4d\u6570&#xff08;\u6bd4\u5982float\u7684123456.789\u53ea\u80fd\u7cbe\u786e\u5230123456&#xff0c;\u540e\u51e0\u4f4d\u662f\u8fd1\u4f3c\u503c&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5185\u5b58\u4e0e\u8303\u56f4 \/ \u7cbe\u5ea6\u7684\u5173\u7cfb&#xff1a;\u5185\u5b58\u8d8a\u5927&#xff0c;\u7cbe\u5ea6\u8d8a\u9ad8\u3001\u8868\u793a\u7684\u6570\u503c\u8303\u56f4\u8d8a\u5e7f&#xff08;double\u662f\u65e5\u5e38\u6700\u5e38\u7528\u7684&#xff0c;\u7cbe\u5ea6\u548c\u8303\u56f4\u8fdc\u4f18\u4e8efloat&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>long double \u7684\u7279\u6b8a\u6027&#xff1a;64 \u4f4d\u7cfb\u7edf\u4e2d&#xff0c;Windows \u901a\u5e38\u548cdouble\u4e00\u6837\u5360 8 \u5b57\u8282&#xff0c;Linux\/macOS \u591a\u4e3a 16 \u5b57\u8282&#xff0c;\u65b0\u624b\u65e5\u5e38\u7528double\u5373\u53ef&#xff0c;\u65e0\u9700\u523b\u610f\u7528long double&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u65e0\u7b26\u53f7\u6d6e\u70b9\u6570&#xff1a;C\/C&#043;&#043; \u4e2d\u6d6e\u70b9\u6570\u6ca1\u6709 unsigned \u7248\u672c&#xff0c;\u9ed8\u8ba4\u90fd\u80fd\u8868\u793a\u6b63\u8d1f\u503c<\/p>\n<\/li>\n<\/ul>\n<h4>&#xff08;3&#xff09;.typeof \u5173\u952e\u5b57<\/h4>\n<p>\n\u7528\u9014&#xff1a;\u7ed9\u7c7b\u578b\u91cd\u547d\u540d&#xff0c;\u7b80\u5316\u7c7b\u578b<br \/>\n\u7528\u6cd5&#xff1a;typedef \u539f\u7c7b\u578b\u540d \u65b0\u7c7b\u578b\u540d&#xff1b;\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Chapter 2&#xff1a;\u6570\u636e\u7c7b\u578b\u4e00\u3001\u6570\u636e\u7c7b\u578b\u7c7b\u578b&#xff0c;\u662f\u76f8\u4f3c\u7684\u6570\u636e\u6240\u636e\u62e5\u6709\u7684\u5171\u540c\u7279\u5f81<br \/>\nC\u5185\u7b80\u5355\u6570\u636e\u7c7b\u578b&#xff1a;\u5b57\u7b26\u578b&#xff0c;\u6574\u578b&#xff0c;\u6d6e\u70b9\u578b&#xff0c;\u5e03\u5c14\u7c7b\u578b&#xff08;1&#xff09;.\u5b57\u7b26\u578b char\u00a0a.\u7528\u5355\u5f15\u53f7\u8868\u793a\u5b57\u7b26&#xff0c;\u7528\u53cc\u5f15\u53f7\\&#8221;\\&#8221;\u8868\u793a\u5b57\u7b26\u4e32<br \/>\nb.ASCII\u7f16\u7801<br \/>\n\u8ba1\u7b97\u673a\u4e2d\u6240\u6709\u6570\u636e&#xff08;\u5305\u62ec\u5b57\u7b26&#xff09;\u4ee5\u4e8c\u8fdb\u5236\u7684\u5f62\u5f0f\u5b58\u50a8&#xff0c;\u800cASCII\u7801\u8868\u4e2d\u8bb0\u5f55\u7684\u5c31\u662f\u6bcf\u4e2a\u5b57\u7b26\u7684\u5bf9\u5e94\u7f16\u7801<\/p>\n","protected":false},"author":2,"featured_media":70271,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7373,7374,7372,55,174,427,729],"topic":[],"class_list":{"0":"post-70273","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-server","8":"tag-acm","9":"tag-7374","10":"tag-7372","11":"tag-c","13":"tag-427","14":"tag-729"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7b97\u6cd5\u7ade\u8d5bC\/C++\uff1a\u6570\u636e\u7c7b\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/70273.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7b97\u6cd5\u7ade\u8d5bC\/C++\uff1a\u6570\u636e\u7c7b\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"Chapter 2&#xff1a;\u6570\u636e\u7c7b\u578b\u4e00\u3001\u6570\u636e\u7c7b\u578b\u7c7b\u578b&#xff0c;\u662f\u76f8\u4f3c\u7684\u6570\u636e\u6240\u636e\u62e5\u6709\u7684\u5171\u540c\u7279\u5f81 C\u5185\u7b80\u5355\u6570\u636e\u7c7b\u578b&#xff1a;\u5b57\u7b26\u578b&#xff0c;\u6574\u578b&#xff0c;\u6d6e\u70b9\u578b&#xff0c;\u5e03\u5c14\u7c7b\u578b&#xff08;1&#xff09;.\u5b57\u7b26\u578b char\u00a0a.\u7528\u5355\u5f15\u53f7\u8868\u793a\u5b57\u7b26&#xff0c;\u7528\u53cc\u5f15\u53f7&quot;&quot;\u8868\u793a\u5b57\u7b26\u4e32 b.ASCII\u7f16\u7801 \u8ba1\u7b97\u673a\u4e2d\u6240\u6709\u6570\u636e&#xff08;\u5305\u62ec\u5b57\u7b26&#xff09;\u4ee5\u4e8c\u8fdb\u5236\u7684\u5f62\u5f0f\u5b58\u50a8&#xff0c;\u800cASCII\u7801\u8868\u4e2d\u8bb0\u5f55\u7684\u5c31\u662f\u6bcf\u4e2a\u5b57\u7b26\u7684\u5bf9\u5e94\u7f16\u7801\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/70273.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-01T10:49:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260201104913-697f2fa99e72a.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/70273.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/70273.html\",\"name\":\"\u7b97\u6cd5\u7ade\u8d5bC\/C++\uff1a\u6570\u636e\u7c7b\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-01T10:49:15+00:00\",\"dateModified\":\"2026-02-01T10:49:15+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/70273.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/70273.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/70273.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7b97\u6cd5\u7ade\u8d5bC\/C++\uff1a\u6570\u636e\u7c7b\u578b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u7b97\u6cd5\u7ade\u8d5bC\/C++\uff1a\u6570\u636e\u7c7b\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/70273.html","og_locale":"zh_CN","og_type":"article","og_title":"\u7b97\u6cd5\u7ade\u8d5bC\/C++\uff1a\u6570\u636e\u7c7b\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"Chapter 2&#xff1a;\u6570\u636e\u7c7b\u578b\u4e00\u3001\u6570\u636e\u7c7b\u578b\u7c7b\u578b&#xff0c;\u662f\u76f8\u4f3c\u7684\u6570\u636e\u6240\u636e\u62e5\u6709\u7684\u5171\u540c\u7279\u5f81 C\u5185\u7b80\u5355\u6570\u636e\u7c7b\u578b&#xff1a;\u5b57\u7b26\u578b&#xff0c;\u6574\u578b&#xff0c;\u6d6e\u70b9\u578b&#xff0c;\u5e03\u5c14\u7c7b\u578b&#xff08;1&#xff09;.\u5b57\u7b26\u578b char\u00a0a.\u7528\u5355\u5f15\u53f7\u8868\u793a\u5b57\u7b26&#xff0c;\u7528\u53cc\u5f15\u53f7\"\"\u8868\u793a\u5b57\u7b26\u4e32 b.ASCII\u7f16\u7801 \u8ba1\u7b97\u673a\u4e2d\u6240\u6709\u6570\u636e&#xff08;\u5305\u62ec\u5b57\u7b26&#xff09;\u4ee5\u4e8c\u8fdb\u5236\u7684\u5f62\u5f0f\u5b58\u50a8&#xff0c;\u800cASCII\u7801\u8868\u4e2d\u8bb0\u5f55\u7684\u5c31\u662f\u6bcf\u4e2a\u5b57\u7b26\u7684\u5bf9\u5e94\u7f16\u7801","og_url":"https:\/\/www.wsisp.com\/helps\/70273.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-01T10:49:15+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260201104913-697f2fa99e72a.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/70273.html","url":"https:\/\/www.wsisp.com\/helps\/70273.html","name":"\u7b97\u6cd5\u7ade\u8d5bC\/C++\uff1a\u6570\u636e\u7c7b\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-01T10:49:15+00:00","dateModified":"2026-02-01T10:49:15+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/70273.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/70273.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/70273.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u7b97\u6cd5\u7ade\u8d5bC\/C++\uff1a\u6570\u636e\u7c7b\u578b"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/70273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=70273"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/70273\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/70271"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=70273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=70273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=70273"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=70273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}