{"id":276,"date":"2015-01-11T13:28:16","date_gmt":"2015-01-11T05:28:16","guid":{"rendered":"http:\/\/yangwang.hk\/?p=276"},"modified":"2015-02-04T16:56:51","modified_gmt":"2015-02-04T08:56:51","slug":"2-6%e3%80%81%e6%95%b0%e6%8d%ae%e7%9a%84%e8%be%93%e5%87%ba","status":"publish","type":"post","link":"https:\/\/yangwang.hk\/?p=276","title":{"rendered":"2.6\u3001\u6570\u636e\u7684\u8f93\u51fa"},"content":{"rendered":"<p>\u672c\u6765\u8fd9\u4e00\u8282\u662f\u51c6\u5907\u653e\u5728\u540e\u9762\u518d\u8bb2\u7684\u3002\u4e0d\u8fc7\u60f3\u4e86\u4e00\u4e0b\u3002\u628a\u8fd9\u4e00\u8282\u5b66\u5b8c\u4e86\u540e\u4f60\u5c31\u53ef\u4ee5\u7b80\u5355\u7684\u8f93\u51fa\u8f93\u51fa\u4e00\u4e9b\u6570\u636e\u4e86\u3002\u80fd\u591f\u5728\u8fd0\u884c\u4e2d\u8f93\u5165\u4e00\u4e9b\u6570\u636e\u3002\u4f60\u80fd\u5199\u51fa\u7684\u7a0b\u5e8f\u5c31\u66f4\u591a\u4e86\u3002<\/p>\n<p>\u540c\u65f6\uff0c\u5982\u679c\u628a\u8f93\u5165\u8f93\u51fa\u653e\u5728\u4e00\u8d77\u8bb2\uff0c\u672a\u514d\u5c31\u6709\u4e9b\u6559\u79d1\u4e66\u7684\u610f\u601d\u4e86\uff0c\u8fd9\u548c\u672c\u6559\u7a0b\u6240\u5e0c\u671b\u7684\u201c\u8f7b\u677e\u6109\u60a6\u201d\u7684\u5b66\u4e60\u73af\u5883\u76f8\u8fdd\u80cc\u3002\u6211\u8ba4\u4e3a\u5b66\u4e60\u5e94\u8be5\u662f\u87ba\u65cb\u5f0f\u7684\u3002\u540c\u6837\u7684\u5185\u5bb9\u5728\u4e0d\u540c\u7684\u65f6\u5019\u5c06\uff0c\u4f60\u5c06\u6709\u7740\u4e0d\u540c\u7684\u6536\u83b7\u3002\u56e0\u6b64\u672c\u8282\u4e2d\u6240\u8bb2\u8ff0\u7684\u5185\u5bb9\uff0c\u5728\u540e\u9762\u7684\u6587\u7ae0\u4e2d\u81f3\u5c11\u8fd8\u4f1a\u63d0\u5230\u4e24\u6b21\u3002<\/p>\n<p>\u8bf4\u4e86\u8fd9\u4e48\u591a\u5e9f\u8bdd\uff0c\u8ba9\u6211\u4eec\u5f00\u59cb\u6b63\u6587\u3002<\/p>\n<p>c\u8bed\u8a00\u4e2d\uff0c\u5e76\u6ca1\u6709\u63d0\u4f9b\u8f93\u51fa\u3001\u8f93\u5165\u7684\u8bed\u53e5\u3002\u56e0\u6b64\u5982\u679c\u6211\u4eec\u9700\u8981\u8f93\u5165\u8f93\u51fa\u4e00\u4e9b\u4fe1\u606f\uff0c\u5c31\u9700\u8981\u4f7f\u7528\u201c\u51fd\u6570\u201d\u3002<\/p>\n<p>\u5728\u524d\u9762\u7684\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5df2\u7ecf\u63a5\u89e6\u5230\u4e86\u4e00\u4e9b\u8f93\u51fa\u4fe1\u606f\u7684\u65b9\u6cd5\uff0c\u6bd4\u5982\u6700\u5f00\u59cb\u7684hello world<\/p>\n<p>\u6211\u4eec\u4f7f\u7528\u4e86\u4e00\u4e2a\u53eb\u505a <em><strong>printf\u00a0\u00a0\u00a0 <\/strong><\/em>\u7684\u51fd\u6570<\/p>\n<p>\u524d\u9762\u5df2\u7ecf\u8bf4\u9053\u8fc7\uff0c<em><strong>printf<\/strong><\/em>\u5c31\u662f<em><strong>print[\u6253\u5370]+format[\u683c\u5f0f]<\/strong><\/em>\uff0c\u4e5f\u5c31\u662f\u683c\u5f0f\u5316\u6253\u5370\u7684\u51fd\u6570\u3002<\/p>\n<p>\u5728\u540e\u9762\uff0c\u6211\u4eec\u4f7f\u7528\u5230\u4e86<em><strong>puts<\/strong><\/em>\u51fd\u6570\uff0c<em><strong>puts<\/strong><\/em>\u5c31\u662f<em><strong>put string[\u5b57\u7b26\u4e32]<\/strong><\/em>\uff0c\u4ece\u5b57\u9762\u4e0a\u6765\u770b\uff0c\u5b83\u53ea\u53ef\u4ee5\u8f93\u51fa\u4e00\u4e2a\u5b57\u7b26\u4e32<\/p>\n<p>\u6b64\u5916\uff0c\u8fd8\u6709\u4e00\u4e2a\u7c7b\u4f3c\u7684\u51fd\u6570\uff0c\u53eb\u505aputchar\uff0c\u8fd9\u4e2a\u5c31\u4e0d\u7528\u89e3\u91ca\u4e86\u5427\uff0c\u770b\u51fd\u6570\u540d\u5c31\u77e5\u9053\u5b83\u662f\u8f93\u51fa\u4e00\u4e2a\u5b57\u7b26\u7684\u610f\u601d\u4e86\uff08\u6211\u4eec\u4ee5\u540e\u547d\u540d\u4e5f\u5e94\u8be5\u8fd9\u6837\uff0c\u89c1\u540d\u77e5\u4e49\uff09<\/p>\n<p>\u73b0\u5728\uff0c\u8ba9\u6211\u4eec\u4ee5\u4e00\u4e2a\u7a0b\u5e8f\u4e3a\u4f8b\uff0c\u5b66\u4e60\u8fd9\u4e09\u4e2a\u51fd\u6570\u7684\u4f7f\u7528\u65b9\u6cd5\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n#include &lt;stdio.h&gt;\r\n#include &lt;stdlib.h&gt;\r\n\r\nint main()\r\n{\r\n    char ch = 'a';      \/\/\u5b9a\u4e49\u4e00\u4e2a\u540d\u4e3ach\u7684char\u578b\u53d8\u91cf\uff0c\u5e76\u521d\u59cb\u5316\u5b57\u7b26a\r\n    int a = 10, d = 0;  \/\/\u5b9a\u4e49\u540d\u5b57\u5206\u522b\u4e3aa\u548cd\u7684int\u578b\u53d8\u91cf\uff0c\u521d\u59cb\u5316\u4e3a10\uff0c0\r\n    double i = 5.5;     \/\/\u5b9a\u4e49\u4e00\u4e2a\u540d\u4e3ai\u7684double\u53d8\u91cf\uff0c\u521d\u59cb\u5316\u4e3a5.5\r\n    float j = 6.23f;    \/\/\u5b9a\u4e49\u4e00\u4e2a\u540d\u4e3aj\u7684float\u53d8\u91cf\uff0c\u521d\u59cb\u5316\u4e3a6.23\r\n\r\n    printf(&quot;ch= '%c'\\n&quot;, ch);             \/\/\u4ee5ascii\u8f93\u51fach\u7684\u503c\r\n    printf(&quot;a=%d,d=%d\\n&quot;, a, d);        \/\/\u8f93\u51faa\u548cd\u7684\u503c\r\n    printf(&quot;i=%lf\\n&quot;, i);               \/\/\u8f93\u51fai\u7684\u503c\r\n    printf(&quot;j=%f\\n&quot;, j);                \/\/\u8f93\u51faj\u7684\u503c\r\n    return 0;\r\n}\r\n\r\n<\/pre>\n<p>\u8bf7\u5148\u590d\u5236\u5230\u7f16\u8f91\u5668\u4e2d\uff0c\u5e76\u7f16\u8bd1\u8fd0\u884c<\/p>\n<p>\u7a0b\u5e8f\u4e2d\u7684\u6ce8\u91ca\u5e94\u8be5\u5df2\u7ecf\u544a\u8bc9\u4e86\u4f60\u5f88\u591a\u4fe1\u606f\u3002<\/p>\n<p>\u7a0b\u5e8f\u7684\u524d\u4e24\u884c\u90fd\u662finclude\uff0c\u56e0\u4e3a\u6211\u4eec\u4f7f\u7528\u7684\u8f93\u51fa\u51fd\u6570\u662f\u522b\u4eba\u5df2\u7ecf\u5199\u597d\u4e86\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u544a\u8bc9\u7f16\u8bd1\u5668\u8fd9\u4e9b\u51fd\u6570\u5728\u54ea\u513f\uff0c\u957f\u4ec0\u4e48\u6a21\u6837<\/p>\n<p>\u7b2c\u56db\u884c<strong>\u5b9a\u4e49\u4e86\u4e00\u4e2amain\u51fd\u6570\uff0c\u7a0b\u5e8f\u5c06\u4ece\u8fd9\u91cc\u5f00\u59cb\u6267\u884c<\/strong><\/p>\n<p>6-9\u884c\u662f\u4e00\u4e9b\u53d8\u91cf\u7684\u5b9a\u4e49\u5982\u679c\u4f60\u524d\u9762\u7684\u6587\u7ae0\u5df2\u7ecf\u770b\u61c2\u4e86\u7684\u8bdd\uff0c\u4e3a\u6253\u8d4c\u4f60\u77e5\u9053\u8fd9\u4e9b\u662f\u4ec0\u4e48\u4e1c\u897f\u3002<\/p>\n<p>\u53ea\u6709\u4e00\u70b9\u9700\u8981\u8bf4\u7684\u662f\uff0c\u5728\u8ba1\u7b97\u673a\u4e2d\uff0c\u6d6e\u70b9\u578b\u5e38\u6570\u90fd\u662fdouble\u7c7b\u578b\u7684\uff0c\u6240\u4ee5\u5982\u679c\u7ed9float\u578b\u53d8\u91cf\u8d4b\u503c\u7684\u8bdd\uff0c\u53ef\u4ee5\u5728\u6570\u5b57\u540e\u9762\u52a0\u4e0af\uff0c\u544a\u8bc9\u7f16\u8bd1\u5668\u8fd9\u662f\u4e00\u4e2afloat\u578b\u7684\u6d6e\u70b9\u6570<\/p>\n<p>\u4f46\u662f\u5176\u5b9e\u4e0d\u5199\u4e5f\u884c\uff0c\u7f16\u8bd1\u5668\u4f1a\u81ea\u52a8\u8f6c\u6362\uff0c\u4e0d\u9700\u8981\u6211\u4eec\u778e\u64cd\u5fc3<\/p>\n<p>\u6211\u4eec\u6240\u9700\u8981\u5b66\u4e60\u7684\u4e1c\u897f\u4ece\u7b2c11\u884c\u5f00\u59cb\u3002<\/p>\n<p>printf\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u62ec\u53f7\uff0c\u62ec\u53f7\u5185\u7684\u4e1c\u897f\u53eb\u505a\u201c\u53c2\u6570\u201d\uff0c\u6211\u4eec\u60f3\u8ba9\u51fd\u6570\u5e72\u4e9b\u4ec0\u4e48\uff0c\u9700\u8981\u544a\u8bc9\u5b83\u4e00\u4e9b\u4fe1\u606f\u3002\u8fd9\u4e9b\u4fe1\u606f\u53ef\u4ee5\u901a\u8fc7\u53c2\u6570\u6765\u4f20\u9012\u7ed9\u6211\u4eec\u6240\u8c03\u7528\u7684\u51fd\u6570\uff08\u5177\u4f53\u5c06\u5728\u540e\u9762\u5b66\u4e60\uff09<\/p>\n<p>\u53c2\u6570\u4e4b\u95f4\u662f\u7528\u9017\u53f7\u9694\u5f00\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4\u4e0b\u9762\u8fd9\u53e5<\/p>\n<p><em><strong>printf(&#8220;ch= &#8216;%c&#8217;\\n&#8221;, ch);<\/strong><\/em><\/p>\n<p>\u5b83\u6709\u4e24\u4e2a\u53c2\u6570\uff0c\u4e00\u4e2a\u662f\u524d\u9762\u7684\u5b57\u7b26\u4e32\u5e38\u91cf<strong>&#8220;ch= &#8216;%c&#8217;\\n&#8221;<\/strong>\uff0c\u8fd9\u4e2a\u53eb\u683c\u5f0f\u63a7\u5236\u53c2\u6570<\/p>\n<p>\u53e6\u4e00\u4e2a\u662f\u540e\u9762\u7684<strong>ch<\/strong>\uff0c\u8fd9\u662f\u4e00\u4e2a\u5b57\u7b26\u578b\u53d8\u91cf\u3002<\/p>\n<p>\u5982\u679c\u4f60\u8fd0\u884c\u4e86\u7a0b\u5e8f\uff0c\u4f60\u5c06\u53d1\u73b0\uff0c\u5b57\u7b26\u4e32\u5e38\u91cf\u4e2d\u7684<em><strong>ch=<\/strong><\/em>\u663e\u793a\u51fa\u6765\u4e86\uff0c\u4f46\u662f\u540e\u9762\u7684&#8217;%c&#8217;\\n\u5462<\/p>\n<p>\u53cd\u5012\u662f\u540e\u9762\u53d8\u91cfch\u7684\u503c\u663e\u793a\u51fa\u6765\u4e86\uff0c\u5e76\u4e14\u597d\u50cf\u5360\u636e\u7684\u662f%c\u7684\u4f4d\u7f6e<\/p>\n<p>\u6ca1\u9519\uff0c\u5c31\u662f\u8fd9\u6837\u3002<\/p>\n<p>\u5728printf\u4e2d\uff0c\u50cf\u8fd9\u6837\u4ee5%\u5f00\u5934\uff0c\u540e\u9762\u8ddf\u4e00\u4e2a\u5b57\u7b26\u7684\u4e1c\u897f\uff0c\u53eb\u505a<em><strong>\u5360\u4f4d\u7b26\u3002<\/strong><\/em><\/p>\n<p>\u5b83\u4f1a\u5360\u4f4f\u4e00\u4e2a\u4f4d\u7f6e\uff0c\u8bf4\u660e\u8fd9\u91cc\u7684\u4fe1\u606f\u7b49\u5f85\u586b\u5145\u3002<\/p>\n<p>\u5c31\u50cf\u4f60\u5728\u56fe\u4e66\u9986\u5360\u5ea7\u4f4d\uff0c\u6254\u4e00\u672c\u4e66\u4e0a\u53bb\uff0c\u544a\u8bc9\u522b\u4eba\uff1a\u8fd9\u91cc\u7684\u4f4d\u7f6e\u5df2\u7ecf\u6709\u4eba\u5360\u4e86\u3002\u4f46\u662f\u5177\u4f53\u662f\u8c01\u5360\u4e86\u5462\uff1f\u6211\u4eec\u4e0d\u4e00\u5b9a\u77e5\u9053\uff0c\u53ea\u6709\u7b49\u8fd9\u4e2a\u4eba\u56de\u6765\u6211\u4eec\u624d\u77e5\u9053\u662f\u8c01\u3002\u5360\u4f4d\u7b26\u8fd9\u4e2a\u4f4d\u7f6e\u4e0a\u7684\u5185\u5bb9\uff0c\u4e5f\u53ea\u6709\u6211\u4eec\u8f93\u51fa\u4e4b\u540e\u624d\u77e5\u9053\u5b83\u5177\u4f53\u662f\u4ec0\u4e48<\/p>\n<p>\u5728printf\u51fd\u6570\u5f80\u5c4f\u5e55\u4e0a\u6253\u5370\u5b57\u7b26\u7684\u65f6\u5019\uff0c\u5360\u4f4d\u7b26\u7684\u4f4d\u7f6e\u5c06\u88ab\u540e\u9762\u53d8\u91cf\u4e2d\u7684\u5185\u5bb9\u586b\u5145\u3002<\/p>\n<p>\u4f60\u53ef\u80fd\u8fd8\u4f1a\u95ee\uff0c\u90a3\\n\u5728\u54ea\u513f\u53bb\u4e86\uff1f<\/p>\n<p>\u8f6c\u4e49\u5b57\u7b26\u5440\uff01\u8fd9\u662f\u4e00\u4e2a\u6362\u884c\u7b26\uff0c\u5f53\u7136\u5c31\u662f\u6362\u884c\u4e86\u3002<\/p>\n<p>\u73b0\u5728\u8bf7\u4f60\u5220\u53bb\u7b2c\u4e00\u4e2aprintf\u540e\u9762\u7684\\n\uff0c\u518d\u7f16\u8bd1\u8fd0\u884c\uff0c\u4f60\u5c06\u53d1\u73b0\u533a\u522b<\/p>\n<p>\u90a3\u4e48%c\u540e\u9762\u7684c\u53c8\u662f\u5e72\u561b\u7684\uff1f<\/p>\n<p>\u56e0\u4e3a\u6570\u636e\u5728\u8ba1\u7b97\u673a\u770b\u6765\uff0c\u662f\u65e0\u5dee\u522b\u7684\u3002\u56e0\u6b64\u6211\u4eec\u9700\u8981\u544a\u8bc9printf\uff0c\u6211\u4eec\u8f93\u51fa\u7684\u8fd9\u4e2a\u53d8\u91cf\u662f\u4ec0\u4e48\u7c7b\u578b\u7684\u3002\u8ba1\u7b97\u673a\u5f88\u7b28\uff0c\u4f46\u662f\u5b83\u5f88\u542c\u8bdd\uff0cc\u5c31\u662f\u544a\u8bc9printf\uff0c\u8fd9\u91cc\u5e94\u8be5\u8f93\u51fa\u4e00\u4e2a\u5b57\u7b26\u7c7b\u578b\u3002<\/p>\n<p>\u5f80\u540e\u770b\uff0c12\u884c\u4e2d\u8f93\u51fa\u4e86\u4e24\u4e2a\u6574\u578b\u6570\u636e\uff0c\u5360\u4f4d\u7b26\u662f%d\uff0c\u4f60\u5e94\u8be5\u731c\u5230d\u5c31\u662f\u544a\u8bc9printf\uff0c\u8fd9\u91cc\u662f\u4e00\u4e2a\u6574\u578b\u6570\u5b57\u4e86\u3002<\/p>\n<p>\u4f46\u662f\u56e0\u4e3a\u6709\u4e24\u4e2a\u53d8\u91cf\u9700\u8981\u6211\u4eec\u8f93\u51fa\uff0c\u6240\u4ee5\u8fd9\u4e2aprintf\u6709\u4e09\u4e2a\u53c2\u6570<\/p>\n<p>\u524d\u9762\u4e00\u4e2a\u8fd8\u662f\u683c\u5f0f\u53c2\u6570\uff0c\u5b83\u544a\u8bc9printf\u5e94\u8be5\u6309\u7167\u600e\u6837\u7684\u683c\u5f0f\u8f93\u51fa\uff0c\u540e\u9762\u5c31\u662f\u6211\u4eec\u9700\u8981\u8f93\u51fa\u7684\u4e24\u4e2a\u53d8\u91cf\uff0ca\u548cd\u3002printf\u81f3\u5c11\u8981\u6709\u4e00\u4e2a\u53c2\u6570\uff0c\u5c31\u662f\u524d\u9762\u7684\u683c\u5f0f\u53c2\u6570\uff0c\u540e\u9762\u7684\u53d8\u91cf\u53eb\u505a\u8f93\u51fa\u5217\u8868\uff0c\u4f60\u53ef\u4ee5\u5199\u5f88\u591a\u4e2a\u53d8\u91cf\uff0c\u5b83\u7684\u6570\u91cf\u4f1a\u6839\u636e\u524d\u9762\u7684\u683c\u5f0f\u63a7\u5236\u53c2\u6570\u800c\u6539\u53d8<\/p>\n<p>\u8fd9\u4e00\u6b21\u7684\u683c\u5f0f\u63a7\u5236\u53c2\u6570\u4e2d\uff0c\u6709\u4e24\u4e2a\u5360\u4f4d\u7b26\uff0c\u53ef\u4ee5\u770b\u51fa\uff0c\u5360\u4f4d\u7b26\u7684\u987a\u5e8f\u548c\u540e\u9762\u8f93\u51fa\u5217\u8868\u4e2d\u6570\u636e\u7684\u987a\u5e8f\u662f\u76f8\u540c\u7684\uff0c\u5982\u679c\u6211\u4eec\u98a0\u5012\u4e86\u540e\u9762\u7684\u53c2\u6570\u987a\u5e8f\uff0cprintf\u8fd8\u662f\u4f1a\u6309\u7167\u6211\u4eec\u89c4\u5b9a\u7684\u683c\u5f0f\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u8bf4\u4f1a\u663e\u793aa=0\uff0cb=10\u3002\u8bf7\u5c1d\u8bd5<\/p>\n<p>\u540e\u9762\u4e24\u884c\u7684printf\u5e94\u8be5\u5f88\u597d\u7406\u89e3\u4e86\u3002%f\u662f\u8f93\u51fafloat\u53d8\u91cf\uff0clf\uff08long float\uff09\u5219\u662fdouble\u3002<\/p>\n<p>\u4e0b\u9762\u7684\u8fd9\u5f20\u8868\u4e2d\uff0c\u8bf4\u660e\u4e86%\u540e\u9762\u6240\u63a5\u5b57\u7b26\u4ee3\u8868\u7684\u542b\u4e49\uff08\u90e8\u5206\uff09<\/p>\n<table class=\"table-view log-set-param\" style=\"height: 402px;\" width=\"501\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"120\">\u5b57\u7b26<\/td>\n<td valign=\"top\" width=\"97\">\u5bf9\u5e94\u7684\u6570\u636e\u7c7b\u578b<\/td>\n<td valign=\"top\" width=\"414\">\u542b\u4e49<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"120\">d \/ i<\/td>\n<td valign=\"top\" width=\"97\">int<\/td>\n<td valign=\"top\" width=\"414\">\u63a5\u53d7\u6574\u6570\u503c\u5e76\u5c06\u5b83\u8868\u793a\u4e3a\u6709\u7b26\u53f7\u7684\u5341\u8fdb\u5236\u6574\u6570\uff0ci\u662f\u8001\u5f0f\u5199\u6cd5<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"120\">o<\/td>\n<td valign=\"top\" width=\"97\">unsigned int<\/td>\n<td valign=\"top\" width=\"414\">\u65e0\u7b26\u53f78\u8fdb\u5236\u6574\u6570(\u4e0d\u8f93\u51fa\u524d\u7f000\uff09<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"120\">\n<div class=\"para\">u<\/div>\n<\/td>\n<td valign=\"top\" width=\"97\">unsigned int<\/td>\n<td valign=\"top\" width=\"414\">\u65e0\u7b26\u53f710\u8fdb\u5236\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"120\">\n<div class=\"para\">x \/ X<\/div>\n<\/td>\n<td valign=\"top\" width=\"97\">unsigned int<\/td>\n<td valign=\"top\" width=\"414\">\u65e0\u7b26\u53f716\u8fdb\u5236\u6574\u6570\uff0cx\u5bf9\u5e94\u7684\u662fabcdef\uff0cX\u5bf9\u5e94\u7684\u662fABCDEF\uff08\u4e0d\u8f93\u51fa\u524d\u7f000x)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"120\">\n<div class=\"para\">f(lf)<\/div>\n<\/td>\n<td valign=\"top\" width=\"97\">float(double)<\/td>\n<td valign=\"top\" width=\"414\">\u5355\u7cbe\u5ea6\u6d6e\u70b9\u6570\u7528f,\u53cc\u7cbe\u5ea6\u6d6e\u70b9\u6570\u7528lf<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"120\">\n<div class=\"para\">e \/ E<\/div>\n<\/td>\n<td valign=\"top\" width=\"97\">double<\/td>\n<td valign=\"top\" width=\"414\">\u79d1\u5b66\u8ba1\u6570\u6cd5\u8868\u793a\u7684\u6570\uff0c\u6b64\u5904&#8221;e&#8221;\u7684\u5927\u5c0f\u5199\u4ee3\u8868\u5728\u8f93\u51fa\u65f6\u7528\u7684\u201ce\u201d\u7684\u5927\u5c0f\u5199<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"120\">\n<div class=\"para\">g \/ G<\/div>\n<\/td>\n<td valign=\"top\" width=\"97\">double<\/td>\n<td valign=\"top\" width=\"414\">\u4f7f\u7528\u4ee5\u4e0a\u4e24\u79cd\u4e2d\u6700\u77ed\u7684\u5f62\u5f0f\uff0c\u5927\u5c0f\u5199\u7684\u4f7f\u7528\u540c%e\u548c%E<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"120\">\n<div class=\"para\">c<\/div>\n<\/td>\n<td valign=\"top\" width=\"97\">char<\/td>\n<td valign=\"top\" width=\"414\">\u5b57\u7b26\u578b\u3002\u53ef\u4ee5\u628a\u8f93\u5165\u7684\u6570\u5b57\u6309\u7167ASCII\u7801\u76f8\u5e94\u8f6c\u6362\u4e3a\u5bf9\u5e94\u7684\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"120\">\n<div class=\"para\">s \/ S<\/div>\n<\/td>\n<td valign=\"top\" width=\"97\">char *<\/td>\n<td valign=\"top\" width=\"414\">\u8f93\u51fa\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\" valign=\"top\" width=\"120\">\n<div class=\"para\">%<\/div>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\" valign=\"top\" width=\"97\">\u65e0\u8f93\u5165<\/td>\n<td colspan=\"1\" rowspan=\"1\" valign=\"top\" width=\"414\">\u4e0d\u8fdb\u884c\u8f6c\u6362\uff0c\u8f93\u51fa\u5b57\u7b26\u2018%\u2019\uff08\u767e\u5206\u53f7\uff09\u672c\u8eab<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u56e0\u4e3a\u6211\u4eec\u73b0\u5728\u8fd8\u6ca1\u6709\u5b66\u201c\u5b57\u7b26\u4e32\u53d8\u91cf\u201d\uff0c\u6240\u4ee5\u57fa\u672c\u4e0a\u7528\u4e0d\u5230\u5b57\u7b26\u4e32\u8f93\u51fa\u7684\u60c5\u51b5<\/p>\n<p>\u7b49\u5230\u4e86\u540e\u9762\u6211\u4eec\u5b66\u4e86\u5982\u4f55\u4fdd\u5b58\u5b57\u7b26\u4e32\uff0c\u6211\u4eec\u518d\u6765\u5b66\u4e60printf\u7684\u4f7f\u7528<\/p>\n<p>putchar\u548c\u4e0a\u9762\u76f8\u6bd4\uff0c\u5c31\u7b80\u5355\u591a\u4e86\uff0c\u4f60\u53ea\u9700\u8981<\/p>\n<p>putchar(ch);\u5c31\u53ef\u4ee5\u5c06ch\u8f93\u51fa<\/p>\n<p>\u8bf7\u81ea\u5df1\u5728\u7a0b\u5e8f\u4e2d\u6dfb\u52a0\u8fd9\u4e00\u53e5\uff0c\u5e76\u89c2\u5bdf\u7ed3\u679c<\/p>\n<p>puts\u548cputchar\u7684\u7528\u6cd5\u76f8\u4f3c\uff0c\u4f46\u662f\u56e0\u4e3a\u5b57\u7b26\u4e32\u8fd8\u6ca1\u6709\u5b66\uff0c\u6545\u653e\u5230\u540e\u9762\u518d\u8bb2\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u6700\u540e\u7559\u4e00\u4e2a\u5b9e\u9a8c\uff0c\u8bf7\u7528\u6574\u578b\u7684\u65b9\u6cd5\u8f93\u51fachar\u7c7b\u578b\u53d8\u91cf\uff0c\u5e76\u5bf9\u6bd4ascii\u8868\uff0c\u770b\u770b\u6709\u4ec0\u4e48\u53d1\u73b0<\/p>\n<p>\u4e00\u5b9a\u8981\u505a\u54e6<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6765\u8fd9\u4e00\u8282\u662f\u51c6\u5907\u653e\u5728\u540e\u9762\u518d\u8bb2\u7684\u3002\u4e0d\u8fc7\u60f3\u4e86\u4e00\u4e0b\u3002\u628a\u8fd9\u4e00\u8282\u5b66\u5b8c\u4e86\u540e\u4f60\u5c31\u53ef\u4ee5\u7b80\u5355\u7684\u8f93\u51fa\u8f93\u51fa\u4e00\u4e9b\u6570\u636e\u4e86\u3002\u80fd\u591f\u5728\u8fd0\u884c\u4e2d\u8f93\u2026 <span class=\"read-more\"><a href=\"https:\/\/yangwang.hk\/?p=276\">Read More: 2.6\u3001\u6570\u636e\u7684\u8f93\u51fa &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-276","post","type-post","status-publish","format-standard","hentry","category-c"],"views":2750,"_links":{"self":[{"href":"https:\/\/yangwang.hk\/index.php?rest_route=\/wp\/v2\/posts\/276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yangwang.hk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yangwang.hk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yangwang.hk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yangwang.hk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=276"}],"version-history":[{"count":3,"href":"https:\/\/yangwang.hk\/index.php?rest_route=\/wp\/v2\/posts\/276\/revisions"}],"predecessor-version":[{"id":337,"href":"https:\/\/yangwang.hk\/index.php?rest_route=\/wp\/v2\/posts\/276\/revisions\/337"}],"wp:attachment":[{"href":"https:\/\/yangwang.hk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yangwang.hk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yangwang.hk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}