{"id":113305,"date":"2026-10-05T22:41:21","date_gmt":"2026-10-05T14:41:21","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/113305.html"},"modified":"2026-10-05T22:41:21","modified_gmt":"2026-10-05T14:41:21","slug":"c%e8%af%ad%e8%a8%80%e5%9f%ba%e7%a1%80%e7%9f%a5%e8%af%86%ef%bc%88%e4%b8%80%ef%bc%89-%e5%90%84%e7%b1%bb%e7%ac%a6%e5%8f%b7%e7%9a%84%e5%90%ab%e4%b9%89%e4%b8%8e%e8%be%93","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/113305.html","title":{"rendered":"C\u8bed\u8a00\u57fa\u7840\u77e5\u8bc6\uff08\u4e00\uff09\u2014\u2014\u2014\u2014\u5404\u7c7b\u7b26\u53f7\u7684\u542b\u4e49\u4e0e\u8f93\u5165\u8f93\u51fa\u5e93\uff08stdio\uff09"},"content":{"rendered":"<h3>\u524d\u8a00<\/h3>\n<p>\u5728\u7f16\u5199 C \u8bed\u8a00\u7a0b\u5e8f\u4e4b\u524d&#xff0c;\u6211\u4eec\u9700\u8981\u5148\u5bfc\u5165\u7a0b\u5e8f\u8fd0\u884c\u6240\u9700\u7684\u5e93&#xff0c;\u8fd9\u4e9b\u5e93\u4e5f\u88ab\u79f0\u4e3a\u5934\u6587\u4ef6\u3002\u672c\u7bc7\u57fa\u7840\u77e5\u8bc6\u5c06\u4ee5 C \u8bed\u8a00\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u5e93 stdio.h \u4e3a\u4f8b\u8fdb\u884c\u8bb2\u89e3\u3002<\/p>\n<h3>\u4e00\u3001\u5360\u4f4d\u7b26&#xff1a;<\/h3>\n<p>\u4e0e Java \u4e0d\u540c&#xff0c;\u5728 C \u8bed\u8a00\u4e2d&#xff0c;\u5360\u4f4d\u7b26\u7528\u4e8e printf\u3001scanf \u8fd9\u7c7b\u683c\u5f0f\u5316\u8f93\u5165\u8f93\u51fa\u51fd\u6570&#xff0c;\u7528\u6765\u6807\u8bb0\u6570\u636e\u7684\u4f4d\u7f6e\u4e0e\u6570\u636e\u7c7b\u578b\u3002\u5728 printf \u8f93\u51fa\u65f6&#xff0c;\u5360\u4f4d\u7b26\u6240\u5728\u7684\u4f4d\u7f6e\u4f1a\u88ab\u66ff\u6362\u4e3a\u53d8\u91cf\u7684\u503c&#xff1b;\u5728 scanf \u8f93\u5165\u65f6&#xff0c;\u5360\u4f4d\u7b26\u5219\u4ee3\u8868\u9700\u8981\u4ece\u63a7\u5236\u53f0\u8bfb\u53d6\u5bf9\u5e94\u7c7b\u578b\u7684\u6570\u636e\u5e76\u5b58\u5165\u53d8\u91cf\u3002<\/p>\n<p>C&#043;&#043; \u4e2d\u5b58\u5728\u4e24\u5957 IO \u4f53\u7cfb&#xff1a;\u5982\u679c\u6cbf\u7528 C \u98ce\u683c\u7684 printf\/scanf&#xff0c;\u5360\u4f4d\u7b26\u7684\u7528\u6cd5\u548c\u89c4\u5219\u4e0e C \u8bed\u8a00\u5b8c\u5168\u4e00\u81f4&#xff1b;\u5982\u679c\u4f7f\u7528 C&#043;&#043; \u539f\u751f\u7684 cout \u4e0e cin \u6d41\u8f93\u5165\u8f93\u51fa&#xff0c;\u5219\u65e0\u9700\u5360\u4f4d\u7b26&#xff0c;\u7cfb\u7edf\u4f1a\u81ea\u52a8\u8bc6\u522b\u53d8\u91cf\u7684\u6570\u636e\u7c7b\u578b\u3002<\/p>\n<p>\u5728 C \u8bed\u8a00\u4e2d&#xff0c;\u53d8\u91cf\u5fc5\u987b\u5148\u58f0\u660e\u540e\u4f7f\u7528&#xff0c;\u58f0\u660e\u65f6\u9700\u8981\u6307\u5b9a\u5176\u6570\u636e\u7c7b\u578b\u3002\u6570\u636e\u7c7b\u578b\u51b3\u5b9a\u4e86\u53d8\u91cf\u5728\u5185\u5b58\u4e2d\u5360\u7528\u7684\u5b57\u8282\u6570\u3001\u53d6\u503c\u8303\u56f4\u4ee5\u53ca\u53ef\u8fdb\u884c\u7684\u8fd0\u7b97\u3002\u4e0b\u9762\u5217\u51fa C \u8bed\u8a00\u4e2d\u5e38\u89c1\u7684\u53d8\u91cf\u7c7b\u578b&#xff1a;<\/p>\n<table>\n<tr>\u6570\u636e\u7c7b\u578b\u5173\u952e\u5b57\u5360\u7528\u5b57\u8282\u6570&#xff08;32\u4f4d\u7cfb\u7edf&#xff09;\u53d6\u503c\u8303\u56f4&#xff08;\u5927\u81f4&#xff09;<\/tr>\n<tbody>\n<tr>\n<td>\u77ed\u6574\u578b<\/td>\n<td>short<\/td>\n<td>2 \u5b57\u8282<\/td>\n<td>-32768 ~ 32767<\/td>\n<\/tr>\n<tr>\n<td>\u6574\u578b<\/td>\n<td>int<\/td>\n<td>4 \u5b57\u8282<\/td>\n<td>-2147483648 ~ 2147483647<\/td>\n<\/tr>\n<tr>\n<td>\u957f\u6574\u578b<\/td>\n<td>long<\/td>\n<td>4 \u5b57\u8282&#xff08;32\u4f4d&#xff09;\/ 8 \u5b57\u8282&#xff08;64\u4f4d&#xff09;<\/td>\n<td>\u53d6\u51b3\u4e8e\u7cfb\u7edf\u4f4d\u6570<\/td>\n<\/tr>\n<tr>\n<td>\u957f\u957f\u6574\u578b<\/td>\n<td>long long<\/td>\n<td>8 \u5b57\u8282<\/td>\n<td>-9223372036854775808 ~ 9223372036854775807<\/td>\n<\/tr>\n<tr>\n<td>\u65e0\u7b26\u53f7\u6574\u578b<\/td>\n<td>unsigned int<\/td>\n<td>4 \u5b57\u8282<\/td>\n<td>0 ~ 4294967295<\/td>\n<\/tr>\n<tr>\n<td>\u5355\u7cbe\u5ea6\u6d6e\u70b9\u578b<\/td>\n<td>float<\/td>\n<td>4 \u5b57\u8282<\/td>\n<td>\u7ea6 3.4e-38 ~ 3.4e38<\/td>\n<\/tr>\n<tr>\n<td>\u53cc\u7cbe\u5ea6\u6d6e\u70b9\u578b<\/td>\n<td>double<\/td>\n<td>8 \u5b57\u8282<\/td>\n<td>\u7ea6 1.7e-308 ~ 1.7e308<\/td>\n<\/tr>\n<tr>\n<td>\u5b57\u7b26\u578b<\/td>\n<td>char<\/td>\n<td>1 \u5b57\u8282<\/td>\n<td>-128 ~ 127&#xff08;\u6216 0 ~ 255&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5b57\u7b26\u4e32<\/td>\n<td>char[]<\/td>\n<td>\u53d6\u51b3\u4e8e\u957f\u5ea6<\/td>\n<td>\u7531\u5b57\u7b26\u6570\u7ec4\u5b58\u50a8<\/td>\n<\/tr>\n<tr>\n<td>\u6307\u9488<\/td>\n<td>void* \/ \u7c7b\u578b*<\/td>\n<td>4 \u5b57\u8282&#xff08;32\u4f4d&#xff09;\/ 8 \u5b57\u8282&#xff08;64\u4f4d&#xff09;<\/td>\n<td>\u5185\u5b58\u5730\u5740<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6ce8\u610f&#xff1a;\u4e0a\u8868\u4e2d\u7684\u5b57\u8282\u6570\u57fa\u4e8e\u5e38\u89c1\u7684 32 \u4f4d\u7cfb\u7edf&#xff0c;\u5b9e\u9645\u5927\u5c0f\u53ef\u80fd\u56e0\u7f16\u8bd1\u5668\u548c\u64cd\u4f5c\u7cfb\u7edf\u800c\u5f02\u3002\u53ef\u4ee5\u4f7f\u7528 sizeof(\u7c7b\u578b) \u8fd0\u7b97\u7b26\u5728\u7a0b\u5e8f\u4e2d\u83b7\u53d6\u67d0\u4e2a\u7c7b\u578b\u5b9e\u9645\u5360\u7528\u7684\u5b57\u8282\u6570\u3002<\/p>\n<p>\u603b\u800c\u8a00\u4e4b&#xff0c;\u5728 C \u548c C&#043;&#043; \u8bed\u8a00\u4e2d&#xff0c;\u5360\u4f4d\u7b26\u5c31\u662f\u53d8\u91cf\u4f4d\u7f6e\u7684\u66ff\u4ee3\u54c1\u3002\u4e0d\u540c\u53d8\u91cf\u5bf9\u5e94\u7684\u5360\u4f4d\u7b26\u5982\u4e0b\u8868\u6240\u793a&#xff1a;<\/p>\n<table>\n<tr>\u6570\u636e\u7c7b\u578b\u5360\u4f4d\u7b26\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>int<\/td>\n<td>%d<\/td>\n<td>\u8f93\u51fa\/\u8f93\u5165\u5341\u8fdb\u5236\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td>long<\/td>\n<td>%ld<\/td>\n<td>\u8f93\u51fa\/\u8f93\u5165\u957f\u6574\u578b\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td>long long<\/td>\n<td>%lld<\/td>\n<td>\u8f93\u51fa\/\u8f93\u5165\u957f\u957f\u6574\u578b\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td>unsigned int<\/td>\n<td>%u<\/td>\n<td>\u8f93\u51fa\/\u8f93\u5165\u65e0\u7b26\u53f7\u5341\u8fdb\u5236\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td>float<\/td>\n<td>%f<\/td>\n<td>\u8f93\u51fa\/\u8f93\u5165\u5355\u7cbe\u5ea6\u6d6e\u70b9\u6570<\/td>\n<\/tr>\n<tr>\n<td>double<\/td>\n<td>%lf<\/td>\n<td>\u8f93\u51fa\/\u8f93\u5165\u53cc\u7cbe\u5ea6\u6d6e\u70b9\u6570&#xff08;scanf \u4e2d\u5fc5\u987b\u7528 %lf&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>char<\/td>\n<td>%c<\/td>\n<td>\u8f93\u51fa\/\u8f93\u5165\u5355\u4e2a\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>char[]&#xff08;\u5b57\u7b26\u4e32&#xff09;<\/td>\n<td>%s<\/td>\n<td>\u8f93\u51fa\/\u8f93\u5165\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n<tr>\n<td>void*&#xff08;\u6307\u9488&#xff09;<\/td>\n<td>%p<\/td>\n<td>\u8f93\u51fa\u6307\u9488\u5730\u5740<\/td>\n<\/tr>\n<tr>\n<td>short<\/td>\n<td>%hd<\/td>\n<td>\u8f93\u51fa\/\u8f93\u5165\u77ed\u6574\u578b\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td>unsigned long<\/td>\n<td>%lu<\/td>\n<td>\u8f93\u51fa\/\u8f93\u5165\u65e0\u7b26\u53f7\u957f\u6574\u578b\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td>unsigned long long<\/td>\n<td>%llu<\/td>\n<td>\u8f93\u51fa\/\u8f93\u5165\u65e0\u7b26\u53f7\u957f\u957f\u6574\u578b\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td>double&#xff08;printf \u8f93\u51fa&#xff09;<\/td>\n<td>%e \/ %E<\/td>\n<td>\u4ee5\u79d1\u5b66\u8ba1\u6570\u6cd5\u8f93\u51fa\u6d6e\u70b9\u6570<\/td>\n<\/tr>\n<tr>\n<td>double&#xff08;printf \u8f93\u51fa&#xff09;<\/td>\n<td>%g \/ %G<\/td>\n<td>\u6839\u636e\u6570\u503c\u5927\u5c0f\u81ea\u52a8\u9009\u62e9 %f \u6216 %e \u8f93\u51fa<\/td>\n<\/tr>\n<tr>\n<td>int&#xff08;\u516b\u8fdb\u5236&#xff09;<\/td>\n<td>%o<\/td>\n<td>\u4ee5\u516b\u8fdb\u5236\u5f62\u5f0f\u8f93\u51fa\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td>int&#xff08;\u5341\u516d\u8fdb\u5236&#xff09;<\/td>\n<td>%x \/ %X<\/td>\n<td>\u4ee5\u5341\u516d\u8fdb\u5236\u5f62\u5f0f\u8f93\u51fa\u6574\u6570&#xff08;\u5c0f\u5199\/\u5927\u5199\u5b57\u6bcd&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u4e8c\u3001\u8f6c\u4e49\u7b26&#xff1a;<\/h3>\n<p>\u5728 C \u8bed\u8a00\u4e2d&#xff0c;\u8f6c\u4e49\u5b57\u7b26\u4ee5\u53cd\u659c\u6760 \\\\ \u5f00\u5934&#xff0c;\u5176\u6838\u5fc3\u4f5c\u7528\u662f\u6539\u53d8\u7d27\u8ddf\u5728\u53cd\u659c\u6760\u540e\u9762\u7684\u5b57\u7b26\u539f\u672c\u7684\u542b\u4e49\u3002\u6709\u4e9b\u5b57\u7b26\u65e0\u6cd5\u76f4\u63a5\u5199\u5728\u5b57\u7b26\u4e32\u4e2d&#xff0c;\u6216\u8005\u672c\u8eab\u5728 C \u8bed\u8a00\u4e2d\u5177\u6709\u7279\u6b8a\u8bed\u6cd5\u4f5c\u7528&#xff0c;\u6b64\u65f6\u5c31\u9700\u8981\u501f\u52a9\u8f6c\u4e49\u7b26\u6765\u8868\u793a\u3002<\/p>\n<p>\u4e3e\u4e2a\u4f8b\u5b50&#xff1a;\u53cc\u5f15\u53f7 &#034; \u662f\u5b57\u7b26\u4e32\u7684\u8fb9\u754c\u6807\u8bb0&#xff0c;\u5982\u679c\u76f4\u63a5\u5199\u5728\u5b57\u7b26\u4e32\u5185\u90e8&#xff0c;\u7f16\u8bd1\u5668\u4f1a\u8bef\u8ba4\u4e3a\u5b57\u7b26\u4e32\u63d0\u524d\u7ed3\u675f&#xff0c;\u4ece\u800c\u5f15\u53d1\u7f16\u8bd1\u9519\u8bef&#xff1b;\u6b64\u65f6\u4f7f\u7528 \\\\&#034;&#xff0c;\u53cd\u659c\u6760\u4f1a\u544a\u8bc9\u7f16\u8bd1\u5668&#xff0c;\u8fd9\u4e2a\u53cc\u5f15\u53f7\u53ea\u662f\u666e\u901a\u5b57\u7b26&#xff0c;\u5e76\u975e\u5b57\u7b26\u4e32\u7ed3\u675f\u7b26&#xff0c;\u6700\u7ec8\u5c31\u80fd\u6b63\u5e38\u8f93\u51fa\u53cc\u5f15\u53f7\u3002\u518d\u6bd4\u5982\u6362\u884c\u64cd\u4f5c&#xff0c;\u6211\u4eec\u65e0\u6cd5\u76f4\u63a5\u5728\u53cc\u5f15\u53f7\u5305\u88f9\u7684\u5b57\u7b26\u4e32\u4e2d\u6572\u56de\u8f66\u6362\u884c&#xff0c;\u4f7f\u7528 \\\\n \u5c31\u53ef\u4ee5\u5b9e\u73b0\u6362\u884c\u529f\u80fd\u3002<\/p>\n<p>\u9664\u4e86 \\\\&#034; \u548c \\\\n \u4e4b\u5916&#xff0c;\u8fd8\u6709\u5f88\u591a\u5e38\u7528\u8f6c\u4e49\u5b57\u7b26&#xff1a;\\\\r \u4ee3\u8868\u56de\u8f66&#xff0c;\u5c06\u5149\u6807\u79fb\u5230\u5f53\u524d\u884c\u7684\u5f00\u5934&#xff1b;\\\\t \u662f\u6c34\u5e73\u5236\u8868\u7b26&#xff0c;\u76f8\u5f53\u4e8e\u6309\u4e0b Tab \u952e&#xff0c;\u7528\u6765\u505a\u6587\u672c\u5bf9\u9f50&#xff1b;\\\\\\\\ \u7528\u6765\u8f93\u51fa\u53cd\u659c\u6760\u672c\u8eab&#xff1b;\\\\0 \u662f\u7a7a\u5b57\u7b26&#xff0c;\u4f5c\u4e3a C \u8bed\u8a00\u5b57\u7b26\u4e32\u7684\u7ed3\u675f\u6807\u8bb0&#xff0c;\u662f\u5b57\u7b26\u4e32\u5fc5\u4e0d\u53ef\u5c11\u7684\u7ec8\u6b62\u7b26\u53f7\u3002<\/p>\n<p>\u7b80\u5355\u6765\u8bf4&#xff0c;\u8f6c\u4e49\u5b57\u7b26\u89e3\u51b3\u4e86\u4e24\u7c7b\u95ee\u9898&#xff1a;\u4e00\u662f\u8868\u793a\u65e0\u6cd5\u76f4\u63a5\u8f93\u5165\u3001\u4e0d\u53ef\u89c1\u7684\u63a7\u5236\u5b57\u7b26&#xff08;\u5982\u6362\u884c\u3001\u5236\u8868\u3001\u5b57\u7b26\u4e32\u7ed3\u675f\u7b26\u7b49&#xff09;&#xff1b;\u4e8c\u662f\u8f6c\u4e49 C \u8bed\u8a00\u4e2d\u81ea\u5e26\u7279\u6b8a\u542b\u4e49\u7684\u7b26\u53f7&#xff08;\u5982\u53cc\u5f15\u53f7\u3001\u53cd\u659c\u6760\u7b49&#xff09;&#xff0c;\u8ba9\u5b83\u4eec\u4e0d\u518d\u627f\u62c5\u8bed\u6cd5\u529f\u80fd&#xff0c;\u800c\u662f\u5355\u7eaf\u4f5c\u4e3a\u666e\u901a\u5b57\u7b26\u8f93\u51fa\u3002<\/p>\n<table>\n<tr>\u8f6c\u4e49\u7b26\u542b\u4e49\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>\\\\n<\/td>\n<td>\u6362\u884c<\/td>\n<td>\u5c06\u5149\u6807\u79fb\u5230\u4e0b\u4e00\u884c\u5f00\u5934<\/td>\n<\/tr>\n<tr>\n<td>\\\\t<\/td>\n<td>\u6c34\u5e73\u5236\u8868\u7b26<\/td>\n<td>\u5c06\u5149\u6807\u79fb\u5230\u4e0b\u4e00\u4e2a\u5236\u8868\u4f4d&#xff08;\u76f8\u5f53\u4e8e\u6309 Tab \u952e&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\\\\\\\\<\/td>\n<td>\u53cd\u659c\u6760<\/td>\n<td>\u8f93\u51fa\u4e00\u4e2a\u53cd\u659c\u6760 \\\\ \u672c\u8eab<\/td>\n<\/tr>\n<tr>\n<td>\\\\&#034;<\/td>\n<td>\u53cc\u5f15\u53f7<\/td>\n<td>\u5728\u5b57\u7b26\u4e32\u4e2d\u8f93\u51fa\u53cc\u5f15\u53f7 &#034;<\/td>\n<\/tr>\n<tr>\n<td>\\\\&#039;<\/td>\n<td>\u5355\u5f15\u53f7<\/td>\n<td>\u5728\u5b57\u7b26\u4e2d\u8f93\u51fa\u5355\u5f15\u53f7 &#039;<\/td>\n<\/tr>\n<tr>\n<td>\\\\r<\/td>\n<td>\u56de\u8f66<\/td>\n<td>\u5c06\u5149\u6807\u79fb\u5230\u5f53\u524d\u884c\u5f00\u5934<\/td>\n<\/tr>\n<tr>\n<td>\\\\b<\/td>\n<td>\u9000\u683c<\/td>\n<td>\u5c06\u5149\u6807\u5411\u5de6\u79fb\u52a8\u4e00\u683c<\/td>\n<\/tr>\n<tr>\n<td>\\\\f<\/td>\n<td>\u6362\u9875<\/td>\n<td>\u5c06\u5149\u6807\u79fb\u5230\u4e0b\u4e00\u9875\u5f00\u5934&#xff08;\u5e38\u7528\u4e8e\u6253\u5370\u673a&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\\\\a<\/td>\n<td>\u54cd\u94c3<\/td>\n<td>\u53d1\u51fa\u63d0\u793a\u97f3&#xff08;\u90e8\u5206\u7ec8\u7aef\u6709\u6548&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\\\\v<\/td>\n<td>\u5782\u76f4\u5236\u8868\u7b26<\/td>\n<td>\u5c06\u5149\u6807\u79fb\u5230\u4e0b\u4e00\u4e2a\u5782\u76f4\u5236\u8868\u4f4d<\/td>\n<\/tr>\n<tr>\n<td>\\\\0<\/td>\n<td>\u7a7a\u5b57\u7b26<\/td>\n<td>\u5b57\u7b26\u4e32\u7ed3\u675f\u6807\u5fd7&#xff08;ASCII \u7801\u4e3a 0&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\\\\xhh<\/td>\n<td>\u5341\u516d\u8fdb\u5236\u8f6c\u4e49<\/td>\n<td>\u8f93\u51fa ASCII \u7801\u4e3a\u5341\u516d\u8fdb\u5236 hh \u7684\u5b57\u7b26&#xff0c;\u5982 \\\\x41 \u8f93\u51fa A<\/td>\n<\/tr>\n<tr>\n<td>\\\\ooo<\/td>\n<td>\u516b\u8fdb\u5236\u8f6c\u4e49<\/td>\n<td>\u8f93\u51fa ASCII \u7801\u4e3a\u516b\u8fdb\u5236 ooo \u7684\u5b57\u7b26&#xff0c;\u5982 \\\\101 \u8f93\u51fa A<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6ce8\u610f&#xff1a;\u8f6c\u4e49\u7b26\u5fc5\u987b\u5199\u5728\u53cc\u5f15\u53f7\u6216\u5355\u5f15\u53f7\u5185\u624d\u4f1a\u751f\u6548\u3002\u4f8b\u5982 printf(&#034;\u7b2c\u4e00\u884c\\\\n\u7b2c\u4e8c\u884c&#034;); \u4f1a\u5728\u8f93\u51fa\u65f6\u6362\u884c\u3002<\/p>\n<h3>\u4e09\u3001\u5934\u6587\u4ef6&#xff1a;&lt;stdio.h&gt; \u6807\u51c6\u8f93\u5165\u8f93\u51fa\u5e93<\/h3>\n<p>\u8be5\u5e93\u5305\u542b\u7684\u51fd\u6570\u6709&#xff1a;printf\u3001scanf\u3001fgets\u3001fputs \u7b49\u3002<\/p>\n<li>printf<\/li>\n<p>printf \u662f\u8f93\u51fa\u6253\u5370\u8bed\u53e5&#xff0c;\u4e00\u822c\u5199\u6cd5\u4e3a printf(&#034;\u60f3\u8f93\u51fa\u7684\u5185\u5bb9&#034;);\u3002\u5982\u679c\u6d89\u53ca\u5230\u53d8\u91cf&#xff0c;\u5219\u5199\u4e3a printf(&#034;\u5185\u5bb9&#043;\u53d8\u91cf\u6240\u5bf9\u5e94\u7684\u5360\u4f4d\u7b26&#034;, \u53d8\u91cf);\u3002<\/p>\n<p>\u4e0b\u9762\u7ed9\u51fa\u51e0\u4e2a printf \u7684\u4ee3\u7801\u793a\u4f8b&#xff1a;<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> age <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">18<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">double<\/span> score <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">92.5<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">char<\/span> grade <span class=\"token operator\">&#061;<\/span> <span class=\"token char\">&#039;A&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">char<\/span> name<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;\u5c0f\u660e&#034;<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ 1. \u8f93\u51fa\u7eaf\u6587\u672c<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Hello, World!\\\\n&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ 2. \u8f93\u51fa\u53d8\u91cf&#xff08;\u5360\u4f4d\u7b26\u5bf9\u5e94\u53d8\u91cf&#xff09;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u5e74\u9f84&#xff1a;%d\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> age<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ 3. \u591a\u4e2a\u5360\u4f4d\u7b26&#xff0c;\u6309\u987a\u5e8f\u5bf9\u5e94\u591a\u4e2a\u53d8\u91cf<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u59d3\u540d&#xff1a;%s&#xff0c;\u6210\u7ee9&#xff1a;%.1f&#xff0c;\u7b49\u7ea7&#xff1a;%c\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> name<span class=\"token punctuation\">,<\/span> score<span class=\"token punctuation\">,<\/span> grade<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ 4. \u5360\u4f4d\u7b26\u4e5f\u53ef\u4ee5\u76f4\u63a5\u653e\u5e38\u91cf\u6216\u8868\u8fbe\u5f0f<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u4e24\u6570\u4e4b\u548c&#xff1a;%d\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">10<\/span> <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>Hello, World!<br \/>\n\u5e74\u9f84&#xff1a;18<br \/>\n\u59d3\u540d&#xff1a;\u5c0f\u660e&#xff0c;\u6210\u7ee9&#xff1a;92.5&#xff0c;\u7b49\u7ea7&#xff1a;A<br \/>\n\u4e24\u6570\u4e4b\u548c&#xff1a;15<\/p>\n<p>\u6ce8\u610f&#xff1a;%.1f \u8868\u793a\u4fdd\u7559\u4e00\u4f4d\u5c0f\u6570&#xff1b;\\\\n \u662f\u6362\u884c\u7b26\u3002\u5360\u4f4d\u7b26\u7684\u6570\u91cf\u3001\u987a\u5e8f\u5fc5\u987b\u4e0e\u540e\u9762\u7684\u53d8\u91cf\u4e00\u4e00\u5bf9\u5e94&#xff0c;\u5426\u5219\u8f93\u51fa\u7ed3\u679c\u4f1a\u9519\u4e71\u3002<\/p>\n<li>scanf<\/li>\n<p>scanf \u7528\u6765\u4ece\u952e\u76d8\u8bfb\u53d6\u7528\u6237\u8f93\u5165\u7684\u6570\u636e\u5e76\u5b58\u50a8\u5728\u53d8\u91cf\u4e2d&#xff0c;\u683c\u5f0f\u4e3a scanf(&#034;\u53d8\u91cf\u5bf9\u5e94\u7684\u5360\u4f4d\u7b26&#034;, &amp;\u53d8\u91cf);\u3002<\/p>\n<p>\u4f46\u662f&#xff0c;\u4f7f\u7528 scanf \u5b58\u50a8\u5185\u5bb9\u65f6\u5b58\u5728\u4e00\u4e2a\u95ee\u9898&#xff1a;\u5982\u679c\u5b58\u50a8\u7684\u662f\u5b57\u7b26\u4e32&#xff0c;\u4e14\u8f93\u5165\u4e2d\u5305\u542b\u7a7a\u683c&#xff0c;\u5219\u65e0\u6cd5\u5b58\u50a8\u7a7a\u683c\u540e\u9762\u7684\u5185\u5bb9\u3002\u4f8b\u5982&#xff1a;<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">char<\/span> a<span class=\"token punctuation\">[<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">scanf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;%s&#034;<\/span><span class=\"token punctuation\">,<\/span><span class=\"token operator\">&amp;<\/span>a<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;%s&#034;<\/span><span class=\"token punctuation\">,<\/span>a<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span> <\/p>\n<p>\u7ed3\u679c&#xff1a;<\/p>\n<p>hello world<br \/>\nhello<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261005144116-6ac3b70cbe82d.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u8fd9\u65f6\u5019&#xff0c;\u6211\u4eec\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e2a\u65b0\u7684\u51fd\u6570\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<li>fgets<\/li>\n<p>fgets \u7528\u6765\u4ece\u8f93\u5165\u6d41\u4e2d\u8bfb\u53d6\u4e00\u884c\u5b57\u7b26\u4e32&#xff0c;\u5e76\u5b58\u50a8\u5230\u6307\u5b9a\u7684\u5b57\u7b26\u6570\u7ec4\u4e2d\u3002\u4e0e scanf \u4e0d\u540c&#xff0c;fgets \u53ef\u4ee5\u8bfb\u53d6\u5305\u542b\u7a7a\u683c\u7684\u6574\u884c\u5185\u5bb9&#xff0c;\u56e0\u6b64\u66f4\u9002\u5408\u5904\u7406\u5e26\u7a7a\u683c\u7684\u5b57\u7b26\u4e32\u8f93\u5165\u3002<\/p>\n<p>fgets \u7684\u683c\u5f0f\u4e3a fgets(\u5b57\u7b26\u6570\u7ec4, \u6700\u5927\u8bfb\u53d6\u5b57\u7b26\u6570, \u8f93\u5165\u6d41);\u3002\u5176\u4e2d&#xff0c;\u7b2c\u4e09\u4e2a\u53c2\u6570 stdin \u8868\u793a\u4ece\u952e\u76d8\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u6570\u636e\u3002<\/p>\n<p>\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e2a\u4f7f\u7528 fgets \u8bfb\u53d6\u5e26\u7a7a\u683c\u5b57\u7b26\u4e32\u7684\u4ee3\u7801\u793a\u4f8b&#xff1a;<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">char<\/span> name<span class=\"token punctuation\">[<\/span><span class=\"token number\">50<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u8bf7\u8f93\u5165\u59d3\u540d&#xff08;\u53ef\u5305\u542b\u7a7a\u683c&#xff09;&#xff1a;&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">fgets<\/span><span class=\"token punctuation\">(<\/span>name<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>name<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token constant\">stdin<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u4f60\u8f93\u5165\u7684\u59d3\u540d\u662f&#xff1a;%s&#034;<\/span><span class=\"token punctuation\">,<\/span> name<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>\u8bf7\u8f93\u5165\u59d3\u540d&#xff08;\u53ef\u5305\u542b\u7a7a\u683c&#xff09;&#xff1a;\u5f20\u4e09 \u674e\u56db<br \/>\n\u4f60\u8f93\u5165\u7684\u59d3\u540d\u662f&#xff1a;\u5f20\u4e09 \u674e\u56db<\/p>\n<p>\u6ce8\u610f&#xff1a;fgets \u4f1a\u628a\u6362\u884c\u7b26\u4e00\u5e76\u8bfb\u5165\u5b57\u7b26\u4e32&#xff0c;\u56e0\u6b64\u8f93\u51fa\u65f6\u4f1a\u5728\u672b\u5c3e\u591a\u51fa\u4e00\u4e2a\u6362\u884c\u3002\u5982\u679c\u60f3\u53bb\u6389\u672b\u5c3e\u7684\u6362\u884c\u7b26&#xff0c;\u53ef\u4ee5\u624b\u52a8\u5c06\u5176\u66ff\u6362\u4e3a\u5b57\u7b26\u4e32\u7ed3\u675f\u7b26 \\\\0\u3002\u6b64\u5916&#xff0c;fgets \u6700\u591a\u8bfb\u53d6 \u6700\u5927\u8bfb\u53d6\u5b57\u7b26\u6570 &#8211; 1 \u4e2a\u5b57\u7b26&#xff0c;\u5269\u4f59\u7a7a\u95f4\u4f1a\u81ea\u52a8\u8865\u4e0a \\\\0&#xff0c;\u4ece\u800c\u907f\u514d\u7f13\u51b2\u533a\u6ea2\u51fa\u3002<\/p>\n<li>fputs<\/li>\n<p>fputs \u7528\u4e8e\u5c06\u5b57\u7b26\u4e32\u5199\u5165\u6307\u5b9a\u7684\u8f93\u51fa\u6d41&#xff0c;\u5176\u57fa\u672c\u683c\u5f0f\u4e3a fputs(\u5b57\u7b26\u4e32, \u8f93\u51fa\u6d41);\u3002\u5176\u4e2d&#xff0c;\u7b2c\u4e8c\u4e2a\u53c2\u6570 stdout \u8868\u793a\u8f93\u51fa\u5230\u5c4f\u5e55\u7684\u6807\u51c6\u8f93\u51fa\u3002\u4e0e printf \u4e0d\u540c&#xff0c;fputs \u65e2\u4e0d\u4f1a\u81ea\u52a8\u6dfb\u52a0\u6362\u884c\u7b26&#xff0c;\u4e5f\u4e0d\u4f1a\u89e3\u6790\u5b57\u7b26\u4e32\u4e2d\u7684\u5360\u4f4d\u7b26&#xff0c;\u800c\u662f\u5c06\u5b57\u7b26\u4e32\u5185\u5bb9\u539f\u6837\u8f93\u51fa\u3002\u56e0\u6b64&#xff0c;fputs \u66f4\u9002\u5408\u7528\u4e8e\u8f93\u51fa\u65e0\u9700\u683c\u5f0f\u5316\u7684\u7eaf\u6587\u672c\u3002<\/p>\n<p>\u5177\u4f53\u6765\u8bf4&#xff0c;fputs \u7684\u8fd4\u56de\u503c\u662f int \u7c7b\u578b&#xff1a;\u5f53\u5199\u5165\u6210\u529f\u65f6\u8fd4\u56de\u975e\u8d1f\u503c&#xff08;\u901a\u5e38\u662f 0&#xff09;&#xff0c;\u5f53\u53d1\u751f\u9519\u8bef\u65f6\u8fd4\u56de EOF&#xff08;\u5373 -1&#xff09;\u3002\u8fd9\u4e00\u7279\u6027\u4f7f\u5f97 fputs \u5728\u9700\u8981\u5224\u65ad\u5199\u5165\u662f\u5426\u6210\u529f\u7684\u573a\u666f\u4e0b\u975e\u5e38\u5b9e\u7528&#xff0c;\u4f8b\u5982\u5728\u6587\u4ef6\u5199\u5165\u6216\u7f51\u7edc\u4f20\u8f93\u4e2d&#xff0c;\u53ef\u4ee5\u901a\u8fc7\u68c0\u67e5\u8fd4\u56de\u503c\u6765\u786e\u8ba4\u6570\u636e\u662f\u5426\u5b8c\u6574\u9001\u8fbe\u3002<\/p>\n<p>\u6b64\u5916&#xff0c;fputs \u7684\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e0d\u4ec5\u53ef\u4ee5\u662f stdout&#xff0c;\u8fd8\u53ef\u4ee5\u662f\u6587\u4ef6\u6307\u9488&#xff08;\u5982 FILE *fp&#xff09;&#xff0c;\u8fd9\u610f\u5473\u7740\u5b83\u540c\u6837\u9002\u7528\u4e8e\u5411\u6587\u4ef6\u5199\u5165\u5b57\u7b26\u4e32\u3002\u4e0e fprintf \u76f8\u6bd4&#xff0c;fputs \u4e0d\u4f1a\u5bf9\u5b57\u7b26\u4e32\u4e2d\u7684 % \u7b49\u5b57\u7b26\u505a\u4efb\u4f55\u7279\u6b8a\u5904\u7406&#xff0c;\u56e0\u6b64\u5f53\u5b57\u7b26\u4e32\u5185\u5bb9\u672c\u8eab\u5305\u542b\u5927\u91cf % \u7b26\u53f7&#xff08;\u5982\u683c\u5f0f\u5316\u6587\u672c\u3001\u65e5\u5fd7\u6a21\u677f&#xff09;\u65f6&#xff0c;\u4f7f\u7528 fputs \u53ef\u4ee5\u907f\u514d\u610f\u5916\u7684\u683c\u5f0f\u89e3\u6790&#xff0c;\u4fdd\u8bc1\u5185\u5bb9\u539f\u6837\u8f93\u51fa\u3002<\/p>\n<p>\u4ece\u5e95\u5c42\u5b9e\u73b0\u6765\u770b&#xff0c;fputs \u4f1a\u9010\u4e2a\u5b57\u7b26\u5730\u5c06\u5b57\u7b26\u4e32\u5199\u5165\u8f93\u51fa\u6d41&#xff0c;\u76f4\u5230\u9047\u5230\u5b57\u7b26\u4e32\u7ed3\u675f\u7b26 \\\\0 \u4e3a\u6b62&#xff0c;\u4f46\u5e76\u4e0d\u4f1a\u628a \\\\0 \u672c\u8eab\u5199\u5165\u3002\u8fd9\u610f\u5473\u7740\u5b83\u975e\u5e38\u9002\u5408\u5904\u7406\u4ee5 \\\\0 \u7ed3\u5c3e\u7684 C \u98ce\u683c\u5b57\u7b26\u4e32&#xff0c;\u800c\u4e0d\u9700\u8981\u989d\u5916\u6307\u5b9a\u5199\u5165\u957f\u5ea6\u3002\u76f8\u6bd4\u4e4b\u4e0b&#xff0c;fwrite \u5219\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u6bcf\u6b21\u5199\u5165\u7684\u5143\u7d20\u5927\u5c0f\u548c\u6570\u91cf&#xff0c;\u4f7f\u7528\u8d77\u6765\u76f8\u5bf9\u7e41\u7410\u3002\u56e0\u6b64&#xff0c;\u5728\u9700\u8981\u8f93\u51fa\u4e00\u6574\u884c\u4ee5 \\\\0 \u7ed3\u5c3e\u7684\u5b57\u7b26\u4e32\u65f6&#xff0c;fputs \u662f\u66f4\u7b80\u6d01\u3001\u66f4\u76f4\u89c2\u7684\u9009\u62e9\u3002<br \/>\n\u5177\u4f53\u6765\u8bf4&#xff0c;fputs \u7684\u8fd4\u56de\u503c\u662f int \u7c7b\u578b&#xff1a;\u5f53\u5199\u5165\u6210\u529f\u65f6\u8fd4\u56de\u975e\u8d1f\u503c&#xff08;\u901a\u5e38\u662f 0&#xff09;&#xff0c;\u5f53\u53d1\u751f\u9519\u8bef\u65f6\u8fd4\u56de EOF&#xff08;\u5373 -1&#xff09;\u3002\u8fd9\u4e00\u7279\u6027\u4f7f\u5f97 fputs \u5728\u9700\u8981\u5224\u65ad\u5199\u5165\u662f\u5426\u6210\u529f\u7684\u573a\u666f\u4e0b\u975e\u5e38\u5b9e\u7528&#xff0c;\u4f8b\u5982\u5728\u6587\u4ef6\u5199\u5165\u6216\u7f51\u7edc\u4f20\u8f93\u4e2d&#xff0c;\u53ef\u4ee5\u901a\u8fc7\u68c0\u67e5\u8fd4\u56de\u503c\u6765\u786e\u8ba4\u6570\u636e\u662f\u5426\u5b8c\u6574\u9001\u8fbe\u3002<\/p>\n<p>\u6b64\u5916&#xff0c;fputs \u7684\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e0d\u4ec5\u53ef\u4ee5\u662f stdout&#xff0c;\u8fd8\u53ef\u4ee5\u662f\u6587\u4ef6\u6307\u9488&#xff08;\u5982 FILE *fp&#xff09;&#xff0c;\u8fd9\u610f\u5473\u7740\u5b83\u540c\u6837\u9002\u7528\u4e8e\u5411\u6587\u4ef6\u5199\u5165\u5b57\u7b26\u4e32\u3002\u4e0e fprintf \u76f8\u6bd4&#xff0c;fputs \u4e0d\u4f1a\u5bf9\u5b57\u7b26\u4e32\u4e2d\u7684 % \u7b49\u5b57\u7b26\u505a\u4efb\u4f55\u7279\u6b8a\u5904\u7406&#xff0c;\u56e0\u6b64\u5f53\u5b57\u7b26\u4e32\u5185\u5bb9\u672c\u8eab\u5305\u542b\u5927\u91cf % \u7b26\u53f7&#xff08;\u5982\u683c\u5f0f\u5316\u6587\u672c\u3001\u65e5\u5fd7\u6a21\u677f&#xff09;\u65f6&#xff0c;\u4f7f\u7528 fputs \u53ef\u4ee5\u907f\u514d\u610f\u5916\u7684\u683c\u5f0f\u89e3\u6790&#xff0c;\u4fdd\u8bc1\u5185\u5bb9\u539f\u6837\u8f93\u51fa\u3002<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">char<\/span> message<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;Hello, fputs!&#034;<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u8f93\u51fa\u5230\u6807\u51c6\u8f93\u51fa&#xff08;\u5c4f\u5e55&#xff09;<\/span><br \/>\n    <span class=\"token function\">fputs<\/span><span class=\"token punctuation\">(<\/span>message<span class=\"token punctuation\">,<\/span> <span class=\"token constant\">stdout<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">fputs<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token constant\">stdout<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u624b\u52a8\u6dfb\u52a0\u6362\u884c<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u4e5f\u53ef\u4ee5\u76f4\u63a5\u8f93\u51fa\u5b57\u7b26\u4e32\u5e38\u91cf<\/span><br \/>\n    <span class=\"token function\">fputs<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u8fd9\u662f\u7b2c\u4e8c\u884c\u5185\u5bb9\u3002\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token constant\">stdout<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>Hello, fputs!<br \/>\n\u8fd9\u662f\u7b2c\u4e8c\u884c\u5185\u5bb9\u3002<\/p>\n<p>\u6ce8\u610f&#xff1a;fputs \u4e0d\u4f1a\u81ea\u52a8\u6362\u884c&#xff0c;\u9700\u8981\u624b\u52a8\u6dfb\u52a0 \\\\n&#xff1b;\u540c\u65f6\u5b83\u4e5f\u4e0d\u4f1a\u89e3\u6790 %d \u8fd9\u7c7b\u5360\u4f4d\u7b26&#xff0c;\u56e0\u6b64\u4e0d\u9002\u5408\u7528\u4e8e\u8f93\u51fa\u53d8\u91cf\u503c\u3002\u82e5\u9700\u8981\u683c\u5f0f\u5316\u8f93\u51fa\u53d8\u91cf&#xff0c;\u5e94\u6539\u7528 printf\u3002\u6b64\u5916&#xff0c;fputs \u4e0e fgets \u662f\u4e00\u5bf9\u4e92\u8865\u51fd\u6570&#xff1a;fgets \u8d1f\u8d23\u4ece\u8f93\u5165\u6d41\u8bfb\u53d6\u6570\u636e&#xff0c;fputs \u8d1f\u8d23\u5411\u8f93\u51fa\u6d41\u5199\u5165\u6570\u636e\u3002<\/p>\n<p>\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d&#xff0c;fputs \u5e38\u7528\u4e8e\u4ee5\u4e0b\u573a\u666f&#xff1a;\u4e00\u662f\u8f93\u51fa\u65e5\u5fd7\u4fe1\u606f&#xff0c;\u56e0\u4e3a\u65e5\u5fd7\u901a\u5e38\u4e0d\u9700\u8981\u683c\u5f0f\u5316&#xff0c;\u76f4\u63a5\u539f\u6837\u5199\u5165\u5373\u53ef&#xff1b;\u4e8c\u662f\u5411\u6587\u4ef6\u8ffd\u52a0\u5185\u5bb9&#xff0c;\u914d\u5408\u6587\u4ef6\u6307\u9488\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0&#xff1b;\u4e09\u662f\u4e0e fgets \u914d\u5408\u5b8c\u6210\u6587\u4ef6\u7684\u9010\u884c\u590d\u5236\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f&#xff0c;fputs \u5199\u5165\u6587\u4ef6\u65f6\u4e0d\u4f1a\u81ea\u52a8\u6dfb\u52a0\u6362\u884c\u7b26&#xff0c;\u56e0\u6b64\u5982\u679c\u5e0c\u671b\u6bcf\u6761\u8bb0\u5f55\u72ec\u5360\u4e00\u884c&#xff0c;\u9700\u8981\u5728\u5b57\u7b26\u4e32\u672b\u5c3e\u624b\u52a8\u52a0\u4e0a \\\\n\u3002<\/p>\n<p>\u53e6\u5916&#xff0c;fputs \u4e0e puts \u4e5f\u6709\u660e\u663e\u533a\u522b&#xff1a;puts \u53ea\u80fd\u5411\u6807\u51c6\u8f93\u51fa stdout \u5199\u5165&#xff0c;\u5e76\u4e14\u4f1a\u5728\u5b57\u7b26\u4e32\u672b\u5c3e\u81ea\u52a8\u8ffd\u52a0\u4e00\u4e2a\u6362\u884c\u7b26&#xff1b;\u800c fputs \u53ef\u4ee5\u6307\u5b9a\u4efb\u610f\u8f93\u51fa\u6d41&#xff0c;\u4e14\u4e0d\u4f1a\u81ea\u52a8\u6362\u884c\u3002\u56e0\u6b64&#xff0c;\u5f53\u9700\u8981\u5411\u6587\u4ef6\u6216\u5176\u4ed6\u8f93\u51fa\u6d41\u5199\u5165\u5185\u5bb9\u3001\u6216\u5e0c\u671b\u5b8c\u5168\u63a7\u5236\u6362\u884c\u884c\u4e3a\u65f6&#xff0c;\u5e94\u4f18\u5148\u9009\u62e9 fputs\u3002<\/p>\n<h3>\u7ec3\u4e60<\/h3>\n<p>1.\u5b9a\u4e49\u4e0d\u540c\u7c7b\u578b\u7684\u53d8\u91cf\u5e76\u8f93\u51fa\u4ed6\u4eec\u7684\u503c\u548c\u6240\u5360\u5b57\u8282\u6570<br \/>\n2.\u8f93\u5165\u5706\u7684\u534a\u5f84&#xff0c;\u8ba1\u7b97\u5e76\u8f93\u51fa\u5706\u7684\u5468\u957f\u548c\u9762\u79ef<br \/>\n3.\u8f93\u5165\u4e00\u4e2a\u4e09\u4f4d\u6570&#xff0c;\u5c06\u5176\u767e\u4f4d\u5341\u4f4d\u4e2a\u4f4d\u5206\u522b\u8f93\u51fa<\/p>\n<h4>1.\u5b9a\u4e49\u4e0d\u540c\u7c7b\u578b\u7684\u53d8\u91cf\u5e76\u8f93\u51fa\u4ed6\u4eec\u7684\u503c\u548c\u6240\u5360\u5b57\u8282\u6570<\/h4>\n<p>\u5728 C \u8bed\u8a00\u4e2d&#xff0c;\u53d8\u91cf\u5fc5\u987b\u5148\u58f0\u660e\u540e\u4f7f\u7528&#xff0c;\u58f0\u660e\u65f6\u9700\u8981\u6307\u5b9a\u5176\u6570\u636e\u7c7b\u578b\u3002\u6570\u636e\u7c7b\u578b\u51b3\u5b9a\u4e86\u53d8\u91cf\u5728\u5185\u5b58\u4e2d\u5360\u7528\u7684\u5b57\u8282\u6570\u3001\u53d6\u503c\u8303\u56f4\u4ee5\u53ca\u53ef\u8fdb\u884c\u7684\u8fd0\u7b97\u3002\u4e0b\u9762\u5217\u51fa C \u8bed\u8a00\u4e2d\u5e38\u89c1\u7684\u53d8\u91cf\u7c7b\u578b&#xff1a;<\/p>\n<table>\n<tr>\u6570\u636e\u7c7b\u578b\u5173\u952e\u5b57\u5360\u7528\u5b57\u8282\u6570&#xff08;32\u4f4d\u7cfb\u7edf&#xff09;\u53d6\u503c\u8303\u56f4&#xff08;\u5927\u81f4&#xff09;<\/tr>\n<tbody>\n<tr>\n<td>\u77ed\u6574\u578b<\/td>\n<td>short<\/td>\n<td>2 \u5b57\u8282<\/td>\n<td>-32768 ~ 32767<\/td>\n<\/tr>\n<tr>\n<td>\u6574\u578b<\/td>\n<td>int<\/td>\n<td>4 \u5b57\u8282<\/td>\n<td>-2147483648 ~ 2147483647<\/td>\n<\/tr>\n<tr>\n<td>\u957f\u6574\u578b<\/td>\n<td>long<\/td>\n<td>4 \u5b57\u8282&#xff08;32\u4f4d&#xff09;\/ 8 \u5b57\u8282&#xff08;64\u4f4d&#xff09;<\/td>\n<td>\u53d6\u51b3\u4e8e\u7cfb\u7edf\u4f4d\u6570<\/td>\n<\/tr>\n<tr>\n<td>\u957f\u957f\u6574\u578b<\/td>\n<td>long long<\/td>\n<td>8 \u5b57\u8282<\/td>\n<td>-9223372036854775808 ~ 9223372036854775807<\/td>\n<\/tr>\n<tr>\n<td>\u65e0\u7b26\u53f7\u6574\u578b<\/td>\n<td>unsigned int<\/td>\n<td>4 \u5b57\u8282<\/td>\n<td>0 ~ 4294967295<\/td>\n<\/tr>\n<tr>\n<td>\u5355\u7cbe\u5ea6\u6d6e\u70b9\u578b<\/td>\n<td>float<\/td>\n<td>4 \u5b57\u8282<\/td>\n<td>\u7ea6 3.4e-38 ~ 3.4e38<\/td>\n<\/tr>\n<tr>\n<td>\u53cc\u7cbe\u5ea6\u6d6e\u70b9\u578b<\/td>\n<td>double<\/td>\n<td>8 \u5b57\u8282<\/td>\n<td>\u7ea6 1.7e-308 ~ 1.7e308<\/td>\n<\/tr>\n<tr>\n<td>\u5b57\u7b26\u578b<\/td>\n<td>char<\/td>\n<td>1 \u5b57\u8282<\/td>\n<td>-128 ~ 127&#xff08;\u6216 0 ~ 255&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5b57\u7b26\u4e32<\/td>\n<td>char[]<\/td>\n<td>\u53d6\u51b3\u4e8e\u957f\u5ea6<\/td>\n<td>\u7531\u5b57\u7b26\u6570\u7ec4\u5b58\u50a8<\/td>\n<\/tr>\n<tr>\n<td>\u6307\u9488<\/td>\n<td>void* \/ \u7c7b\u578b*<\/td>\n<td>4 \u5b57\u8282&#xff08;32\u4f4d&#xff09;\/ 8 \u5b57\u8282&#xff08;64\u4f4d&#xff09;<\/td>\n<td>\u5185\u5b58\u5730\u5740<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6ce8\u610f&#xff1a;\u4e0a\u8868\u4e2d\u7684\u5b57\u8282\u6570\u57fa\u4e8e\u5e38\u89c1\u7684 32 \u4f4d\u7cfb\u7edf&#xff0c;\u5b9e\u9645\u5927\u5c0f\u53ef\u80fd\u56e0\u7f16\u8bd1\u5668\u548c\u64cd\u4f5c\u7cfb\u7edf\u800c\u5f02\u3002\u53ef\u4ee5\u4f7f\u7528 sizeof(\u7c7b\u578b) \u8fd0\u7b97\u7b26\u5728\u7a0b\u5e8f\u4e2d\u83b7\u53d6\u67d0\u4e2a\u7c7b\u578b\u5b9e\u9645\u5360\u7528\u7684\u5b57\u8282\u6570\u3002<\/p>\n<p>\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e2a\u5b8c\u6574\u7684\u4ee3\u7801\u793a\u4f8b&#xff0c;\u6f14\u793a\u5982\u4f55\u5b9a\u4e49\u4e0d\u540c\u7c7b\u578b\u7684\u53d8\u91cf&#xff0c;\u5e76\u4f7f\u7528 sizeof \u8fd0\u7b97\u7b26\u8f93\u51fa\u5b83\u4eec\u7684\u503c\u548c\u6240\u5360\u5b57\u8282\u6570&#xff1a;<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u5b9a\u4e49\u4e0d\u540c\u7c7b\u578b\u7684\u53d8\u91cf<\/span><br \/>\n    <span class=\"token keyword\">short<\/span> s <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">10<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">100<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">long<\/span> l <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">100000L<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">long<\/span> <span class=\"token keyword\">long<\/span> ll <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">10000000000LL<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">int<\/span> ui <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">3000000000U<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">float<\/span> f <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">3.14f<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">double<\/span> d <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">3.14159265358979<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">char<\/span> c <span class=\"token operator\">&#061;<\/span> <span class=\"token char\">&#039;A&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">char<\/span> str<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;Hello&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> <span class=\"token operator\">*<\/span>p <span class=\"token operator\">&#061;<\/span> <span class=\"token operator\">&amp;<\/span>i<span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u8f93\u51fa\u53d8\u91cf\u7684\u503c<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;short \u53d8\u91cf s \u7684\u503c&#xff1a;%hd\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> s<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;int \u53d8\u91cf i \u7684\u503c&#xff1a;%d\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> i<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;long \u53d8\u91cf l \u7684\u503c&#xff1a;%ld\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> l<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;long long \u53d8\u91cf ll \u7684\u503c&#xff1a;%lld\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> ll<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;unsigned int \u53d8\u91cf ui \u7684\u503c&#xff1a;%u\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> ui<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;float \u53d8\u91cf f \u7684\u503c&#xff1a;%f\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> f<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;double \u53d8\u91cf d \u7684\u503c&#xff1a;%lf\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> d<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;char \u53d8\u91cf c \u7684\u503c&#xff1a;%c\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> c<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u5b57\u7b26\u4e32 str \u7684\u503c&#xff1a;%s\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> str<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u6307\u9488 p \u6307\u5411\u7684\u5730\u5740&#xff1a;%p\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">void<\/span><span class=\"token operator\">*<\/span><span class=\"token punctuation\">)<\/span>p<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u8f93\u51fa\u5404\u53d8\u91cf\u6240\u5360\u7684\u5b57\u8282\u6570<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\\\\n\u5404\u53d8\u91cf\u6240\u5360\u5b57\u8282\u6570&#xff1a;\\\\n&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;short \u5360 %zu \u5b57\u8282\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>s<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;int \u5360 %zu \u5b57\u8282\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>i<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;long \u5360 %zu \u5b57\u8282\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>l<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;long long \u5360 %zu \u5b57\u8282\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>ll<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;unsigned int \u5360 %zu \u5b57\u8282\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>ui<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;float \u5360 %zu \u5b57\u8282\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>f<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;double \u5360 %zu \u5b57\u8282\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>d<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;char \u5360 %zu \u5b57\u8282\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>c<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u5b57\u7b26\u4e32 str \u5360 %zu \u5b57\u8282\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>str<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u6307\u9488 p \u5360 %zu \u5b57\u8282\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>p<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff08;\u5728 64 \u4f4d\u7cfb\u7edf\u4e0a&#xff09;&#xff1a;<\/p>\n<p>short \u53d8\u91cf s \u7684\u503c&#xff1a;10<br \/>\nint \u53d8\u91cf i \u7684\u503c&#xff1a;100<br \/>\nlong \u53d8\u91cf l \u7684\u503c&#xff1a;100000<br \/>\nlong long \u53d8\u91cf ll \u7684\u503c&#xff1a;10000000000<br \/>\nunsigned int \u53d8\u91cf ui \u7684\u503c&#xff1a;3000000000<br \/>\nfloat \u53d8\u91cf f \u7684\u503c&#xff1a;3.140000<br \/>\ndouble \u53d8\u91cf d \u7684\u503c&#xff1a;3.141593<br \/>\nchar \u53d8\u91cf c \u7684\u503c&#xff1a;A<br \/>\n\u5b57\u7b26\u4e32 str \u7684\u503c&#xff1a;Hello<br \/>\n\u6307\u9488 p \u6307\u5411\u7684\u5730\u5740&#xff1a;0x7ffd12345678<\/p>\n<p>\u5404\u53d8\u91cf\u6240\u5360\u5b57\u8282\u6570&#xff1a;<br \/>\nshort \u5360 2 \u5b57\u8282<br \/>\nint \u5360 4 \u5b57\u8282<br \/>\nlong \u5360 8 \u5b57\u8282<br \/>\nlong long \u5360 8 \u5b57\u8282<br \/>\nunsigned int \u5360 4 \u5b57\u8282<br \/>\nfloat \u5360 4 \u5b57\u8282<br \/>\ndouble \u5360 8 \u5b57\u8282<br \/>\nchar \u5360 1 \u5b57\u8282<br \/>\n\u5b57\u7b26\u4e32 str \u5360 6 \u5b57\u8282<br \/>\n\u6307\u9488 p \u5360 8 \u5b57\u8282<\/p>\n<p>\u6ce8\u610f&#xff1a;sizeof \u8fd4\u56de\u7684\u662f size_t \u7c7b\u578b&#xff0c;\u56e0\u6b64\u4f7f\u7528 %zu \u4f5c\u4e3a\u5360\u4f4d\u7b26\u8f93\u51fa\u3002\u5b57\u7b26\u4e32 str \u5360 6 \u5b57\u8282&#xff0c;\u662f\u56e0\u4e3a\u5b83\u5305\u542b 5 \u4e2a\u5b57\u7b26\u52a0\u4e0a\u672b\u5c3e\u7684\u5b57\u7b26\u4e32\u7ed3\u675f\u7b26 \\\\0\u3002\u6307\u9488\u7684\u5927\u5c0f\u53d6\u51b3\u4e8e\u7cfb\u7edf\u4f4d\u6570&#xff0c;\u5728 64 \u4f4d\u7cfb\u7edf\u4e0a\u4e3a 8 \u5b57\u8282&#xff0c;\u5728 32 \u4f4d\u7cfb\u7edf\u4e0a\u4e3a 4 \u5b57\u8282\u3002<\/p>\n<h4>2.\u8f93\u5165\u5706\u7684\u534a\u5f84&#xff0c;\u8ba1\u7b97\u5e76\u8f93\u51fa\u5706\u7684\u5468\u957f\u548c\u9762\u79ef<\/h4>\n<p>\u8f93\u5165\u503c\u5e76\u4ee5\u8fd9\u4e2a\u503c\u8fdb\u884c\u8fd0\u7b97&#xff0c;\u8fd9\u65f6\u5019\u6211\u4eec\u9700\u8981\u7528\u5230scanf\u3002\u8f93\u51fa\u5468\u957f\u548c\u9762\u79ef\u5219\u9700\u8981\u6211\u4eecprintf\u548c\u6570\u5b66\u516c\u5f0f<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261005144117-6ac3b70dee1ce.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><br \/>\n\u7ed3\u679c\u4e3a&#xff1a;<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261005144118-6ac3b70e402df.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>3.\u8f93\u5165\u4e00\u4e2a\u4e09\u4f4d\u6570&#xff0c;\u5c06\u5176\u767e\u4f4d\u5341\u4f4d\u4e2a\u4f4d\u5206\u522b\u8f93\u51fa<\/h3>\n<p>\u8fd9\u65f6\u5019\u6211\u4eec\u6709\u4e24\u79cd\u601d\u8def\u3002<br \/>\n\u7b2c\u4e00\u79cd&#xff0c;\u7528\u6570\u5b57\u8fd0\u7b97&#xff0c;\u91c7\u7528\u53d6\u4f59\u6574\u9664\u7684\u65b9\u5f0f&#xff1a;<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261005144119-6ac3b70f067f1.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><br \/>\n\u7b2c\u4e8c\u79cd&#xff0c;\u7528\u6570\u7ec4\u7684\u65b9\u5f0f&#xff0c;\u6211\u4eec\u53ef\u4ee5\u5c06\u8f93\u5165\u7684\u4e09\u4f4d\u6570\u770b\u4f5c\u662f\u4e00\u4e2a\u6570\u7ec4&#xff0c;\u7136\u540e\u8bfb\u53d6\u5373\u53ef<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261005144119-6ac3b70f7661a.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261005144119-6ac3b70fe6bfc.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u53ef\u80fd\u6709\u4eba\u4f1a\u95ee\u4e86&#xff0c;\u6211\u4eec\u4e3a\u4ec0\u4e48\u8981\u51cf\u53bb\u8fd9\u4e2a\u20190\u2019\u5462&#xff1f;<br \/>\n\u6211\u4eec\u5148\u8bb0\u4f4f&#xff1a;\u20180\u2019 \u662f\u5b57\u7b260&#xff0c;\u4e0d\u662f\u6570\u5b570\u3002\u8ba1\u7b97\u673a\u5185\u5b58\u91cc\u6240\u6709\u5b57\u7b26\u5b58\u7684\u90fd\u662fASCII\u7801\u3002<br \/>\n\u5b57\u7b26\u20190\u2019\u7684ASCII\u7801\u662f 48<br \/>\n\u5b57\u7b26\u20191\u2019\u7684ASCII\u7801\u662f 49<br \/>\n\u5b57\u7b26\u20192\u2019\u7684ASCII\u7801\u662f 50<br \/>\n\u2026\u2026<br \/>\n\u5b57\u7b26\u20199\u2019\u7684ASCII\u7801\u662f 57<\/p>\n<p>\u5f53\u6211\u4eec\u7528%s\u8bfb\u53d6\u8f93\u5165123\u5230\u5b57\u7b26\u6570\u7ec4\u91cc&#xff1a;<br \/>\nnum[0]\u91cc\u9762\u5b58\u7684\u5e76\u4e0d\u662f\u6574\u65701&#xff0c;\u800c\u662f\u5b57\u7b26\u20191\u2019&#xff0c;\u5b83\u5bf9\u5e94\u7684ASCII\u7801\u662f49\u3002<br \/>\n\u5982\u679c\u4f60\u76f4\u63a5printf(\u201c%d\u201d, num[0])&#xff0c;\u8f93\u51fa\u7684\u4f1a\u662f49&#xff0c;\u800c\u4e0d\u662f\u6211\u4eec\u60f3\u8981\u76841\u3002<\/p>\n<p>\u20181\u2019 &#8211; \u20180\u2019 \u7b49\u4ef7\u4e8e 49 &#8211; 48 &#061; 1<br \/>\n\u7528\u5b57\u7b26\u51cf\u53bb\u20190\u2019&#xff0c;\u672c\u8d28\u5c31\u662f\u7528ASCII\u7801\u76f8\u51cf&#xff0c;\u628a\u6570\u5b57\u5b57\u7b26\u8f6c\u6362\u6210\u771f\u6b63\u7684\u6574\u578b\u6570\u5b57\u3002<br \/>\n\u4e0b\u9762\u662f\u4e0d\u5199\u51cf\u53bb\u20190\u2019\u7684\u4ee3\u7801\u7ed3\u679c&#xff1a;<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261005144120-6ac3b71015966.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>\u603b\u7ed3<\/h3>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u8bb2\u89e3\u4e86 C \u8bed\u8a00\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u5e93 &lt;stdio.h&gt; \u7684\u57fa\u7840\u77e5\u8bc6&#xff0c;\u6838\u5fc3\u5185\u5bb9\u53ef\u603b\u7ed3\u4e3a\u4e09\u90e8\u5206&#xff1a;<\/p>\n<p>\u4e00\u3001\u5360\u4f4d\u7b26&#xff1a;\u7528\u4e8e printf\/scanf \u7b49\u683c\u5f0f\u5316\u51fd\u6570&#xff0c;\u6807\u8bb0\u6570\u636e\u4f4d\u7f6e\u4e0e\u7c7b\u578b\u3002\u6587\u4e2d\u7ed9\u51fa\u4e86\u5b8c\u6574\u5bf9\u7167\u8868&#xff0c;\u8986\u76d6 int&#xff08;%d&#xff09;\u3001long&#xff08;%ld&#xff09;\u3001float&#xff08;%f&#xff09;\u3001double&#xff08;%lf&#xff09;\u3001char&#xff08;%c&#xff09;\u3001\u5b57\u7b26\u4e32&#xff08;%s&#xff09;\u3001\u6307\u9488&#xff08;%p&#xff09;\u7b49\u5e38\u7528\u7c7b\u578b&#xff0c;\u5e76\u8bf4\u660e C&#043;&#043; \u6cbf\u7528 C \u98ce\u683c\u65f6\u89c4\u5219\u4e00\u81f4\u3002<\/p>\n<p>\u4e8c\u3001\u8f6c\u4e49\u7b26&#xff1a;\u4ee5\u53cd\u659c\u6760 \\\\ \u5f00\u5934&#xff0c;\u7528\u4e8e\u8868\u793a\u65e0\u6cd5\u76f4\u63a5\u8f93\u5165\u7684\u5b57\u7b26\u6216\u8f6c\u4e49\u7279\u6b8a\u7b26\u53f7\u3002\u8868\u683c\u5217\u51fa\u4e86 \\\\n&#xff08;\u6362\u884c&#xff09;\u3001\\\\t&#xff08;\u5236\u8868\u7b26&#xff09;\u3001\\\\&#xff08;\u53cd\u659c\u6760&#xff09;\u3001&#034;&#xff08;\u53cc\u5f15\u53f7&#xff09;\u3001\\\\0&#xff08;\u5b57\u7b26\u4e32\u7ed3\u675f\u7b26&#xff09;\u7b49\u5e38\u7528\u8f6c\u4e49\u7b26\u53ca\u5176\u542b\u4e49\u3002<\/p>\n<p>\u4e09\u3001\u5934\u6587\u4ef6 &lt;stdio.h&gt; \u7684\u56db\u4e2a\u6838\u5fc3\u51fd\u6570&#xff1a;<br \/>\nprintf&#xff1a;\u683c\u5f0f\u5316\u8f93\u51fa&#xff0c;\u652f\u6301\u5360\u4f4d\u7b26\u4e0e\u53d8\u91cf\u4e00\u4e00\u5bf9\u5e94&#xff0c;\u9644\u6709\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b&#xff1b;<br \/>\nscanf&#xff1a;\u4ece\u952e\u76d8\u8bfb\u53d6\u8f93\u5165&#xff0c;\u4f46\u65e0\u6cd5\u8bfb\u53d6\u542b\u7a7a\u683c\u7684\u5b57\u7b26\u4e32&#xff1b;<br \/>\nfgets&#xff1a;\u53ef\u8bfb\u53d6\u5305\u542b\u7a7a\u683c\u7684\u6574\u884c\u5b57\u7b26\u4e32&#xff0c;\u66f4\u9002\u5408\u5904\u7406\u5e26\u7a7a\u683c\u7684\u8f93\u5165&#xff1b;<br \/>\nfputs&#xff1a;\u5411\u8f93\u51fa\u6d41\u539f\u6837\u5199\u5165\u5b57\u7b26\u4e32&#xff0c;\u4e0d\u89e3\u6790\u5360\u4f4d\u7b26\u3001\u4e0d\u81ea\u52a8\u6362\u884c&#xff0c;\u9002\u5408\u8f93\u51fa\u7eaf\u6587\u672c\u6216\u5199\u6587\u4ef6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00<br \/>\n\u5728\u7f16\u5199 C \u8bed\u8a00\u7a0b\u5e8f\u4e4b\u524d&#xff0c;\u6211\u4eec\u9700\u8981\u5148\u5bfc\u5165\u7a0b\u5e8f\u8fd0\u884c\u6240\u9700\u7684\u5e93&#xff0c;\u8fd9\u4e9b\u5e93\u4e5f\u88ab\u79f0\u4e3a\u5934\u6587\u4ef6\u3002\u672c\u7bc7\u57fa\u7840\u77e5\u8bc6\u5c06\u4ee5 C \u8bed\u8a00\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u5e93 stdio.h \u4e3a\u4f8b\u8fdb\u884c\u8bb2\u89e3\u3002<br \/>\n\u4e00\u3001\u5360\u4f4d\u7b26&#xff1a;<br \/>\n\u4e0e Java \u4e0d\u540c&#xff0c;\u5728 C \u8bed\u8a00\u4e2d&#xff0c;\u5360\u4f4d\u7b26\u7528\u4e8e printf\u3001scanf \u8fd9\u7c7b\u683c\u5f0f\u5316\u8f93\u5165\u8f93\u51fa\u51fd\u6570&#xff0c;\u7528\u6765\u6807\u8bb0\u6570\u636e\u7684\u4f4d\u7f6e\u4e0e\u6570\u636e\u7c7b\u578b\u3002\u5728 printf \u8f93\u51fa\u65f6&#xff0c;\u5360\u4f4d\u7b26\u6240\u5728\u7684\u4f4d\u7f6e\u4f1a\u88ab\u66ff\u6362\u4e3a\u53d8\u91cf\u7684\u503c&#xff1b;\u5728 <\/p>\n","protected":false},"author":2,"featured_media":113298,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[174,190],"topic":[],"class_list":["post-113305","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-c","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C\u8bed\u8a00\u57fa\u7840\u77e5\u8bc6\uff08\u4e00\uff09\u2014\u2014\u2014\u2014\u5404\u7c7b\u7b26\u53f7\u7684\u542b\u4e49\u4e0e\u8f93\u5165\u8f93\u51fa\u5e93\uff08stdio\uff09 - \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\/113305.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C\u8bed\u8a00\u57fa\u7840\u77e5\u8bc6\uff08\u4e00\uff09\u2014\u2014\u2014\u2014\u5404\u7c7b\u7b26\u53f7\u7684\u542b\u4e49\u4e0e\u8f93\u5165\u8f93\u51fa\u5e93\uff08stdio\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u524d\u8a00 \u5728\u7f16\u5199 C \u8bed\u8a00\u7a0b\u5e8f\u4e4b\u524d&#xff0c;\u6211\u4eec\u9700\u8981\u5148\u5bfc\u5165\u7a0b\u5e8f\u8fd0\u884c\u6240\u9700\u7684\u5e93&#xff0c;\u8fd9\u4e9b\u5e93\u4e5f\u88ab\u79f0\u4e3a\u5934\u6587\u4ef6\u3002\u672c\u7bc7\u57fa\u7840\u77e5\u8bc6\u5c06\u4ee5 C \u8bed\u8a00\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u5e93 stdio.h \u4e3a\u4f8b\u8fdb\u884c\u8bb2\u89e3\u3002 \u4e00\u3001\u5360\u4f4d\u7b26&#xff1a; \u4e0e Java \u4e0d\u540c&#xff0c;\u5728 C \u8bed\u8a00\u4e2d&#xff0c;\u5360\u4f4d\u7b26\u7528\u4e8e printf\u3001scanf \u8fd9\u7c7b\u683c\u5f0f\u5316\u8f93\u5165\u8f93\u51fa\u51fd\u6570&#xff0c;\u7528\u6765\u6807\u8bb0\u6570\u636e\u7684\u4f4d\u7f6e\u4e0e\u6570\u636e\u7c7b\u578b\u3002\u5728 printf \u8f93\u51fa\u65f6&#xff0c;\u5360\u4f4d\u7b26\u6240\u5728\u7684\u4f4d\u7f6e\u4f1a\u88ab\u66ff\u6362\u4e3a\u53d8\u91cf\u7684\u503c&#xff1b;\u5728\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/113305.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-05T14:41:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261005144116-6ac3b70cbe82d.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=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/113305.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/113305.html\",\"name\":\"C\u8bed\u8a00\u57fa\u7840\u77e5\u8bc6\uff08\u4e00\uff09\u2014\u2014\u2014\u2014\u5404\u7c7b\u7b26\u53f7\u7684\u542b\u4e49\u4e0e\u8f93\u5165\u8f93\u51fa\u5e93\uff08stdio\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-05T14:41:21+00:00\",\"dateModified\":\"2026-10-05T14:41:21+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/113305.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/113305.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/113305.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C\u8bed\u8a00\u57fa\u7840\u77e5\u8bc6\uff08\u4e00\uff09\u2014\u2014\u2014\u2014\u5404\u7c7b\u7b26\u53f7\u7684\u542b\u4e49\u4e0e\u8f93\u5165\u8f93\u51fa\u5e93\uff08stdio\uff09\"}]},{\"@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":"C\u8bed\u8a00\u57fa\u7840\u77e5\u8bc6\uff08\u4e00\uff09\u2014\u2014\u2014\u2014\u5404\u7c7b\u7b26\u53f7\u7684\u542b\u4e49\u4e0e\u8f93\u5165\u8f93\u51fa\u5e93\uff08stdio\uff09 - \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\/113305.html","og_locale":"zh_CN","og_type":"article","og_title":"C\u8bed\u8a00\u57fa\u7840\u77e5\u8bc6\uff08\u4e00\uff09\u2014\u2014\u2014\u2014\u5404\u7c7b\u7b26\u53f7\u7684\u542b\u4e49\u4e0e\u8f93\u5165\u8f93\u51fa\u5e93\uff08stdio\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u524d\u8a00 \u5728\u7f16\u5199 C \u8bed\u8a00\u7a0b\u5e8f\u4e4b\u524d&#xff0c;\u6211\u4eec\u9700\u8981\u5148\u5bfc\u5165\u7a0b\u5e8f\u8fd0\u884c\u6240\u9700\u7684\u5e93&#xff0c;\u8fd9\u4e9b\u5e93\u4e5f\u88ab\u79f0\u4e3a\u5934\u6587\u4ef6\u3002\u672c\u7bc7\u57fa\u7840\u77e5\u8bc6\u5c06\u4ee5 C \u8bed\u8a00\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u5e93 stdio.h \u4e3a\u4f8b\u8fdb\u884c\u8bb2\u89e3\u3002 \u4e00\u3001\u5360\u4f4d\u7b26&#xff1a; \u4e0e Java \u4e0d\u540c&#xff0c;\u5728 C \u8bed\u8a00\u4e2d&#xff0c;\u5360\u4f4d\u7b26\u7528\u4e8e printf\u3001scanf \u8fd9\u7c7b\u683c\u5f0f\u5316\u8f93\u5165\u8f93\u51fa\u51fd\u6570&#xff0c;\u7528\u6765\u6807\u8bb0\u6570\u636e\u7684\u4f4d\u7f6e\u4e0e\u6570\u636e\u7c7b\u578b\u3002\u5728 printf \u8f93\u51fa\u65f6&#xff0c;\u5360\u4f4d\u7b26\u6240\u5728\u7684\u4f4d\u7f6e\u4f1a\u88ab\u66ff\u6362\u4e3a\u53d8\u91cf\u7684\u503c&#xff1b;\u5728","og_url":"https:\/\/www.wsisp.com\/helps\/113305.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-05T14:41:21+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261005144116-6ac3b70cbe82d.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/113305.html","url":"https:\/\/www.wsisp.com\/helps\/113305.html","name":"C\u8bed\u8a00\u57fa\u7840\u77e5\u8bc6\uff08\u4e00\uff09\u2014\u2014\u2014\u2014\u5404\u7c7b\u7b26\u53f7\u7684\u542b\u4e49\u4e0e\u8f93\u5165\u8f93\u51fa\u5e93\uff08stdio\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-05T14:41:21+00:00","dateModified":"2026-10-05T14:41:21+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/113305.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/113305.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/113305.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"C\u8bed\u8a00\u57fa\u7840\u77e5\u8bc6\uff08\u4e00\uff09\u2014\u2014\u2014\u2014\u5404\u7c7b\u7b26\u53f7\u7684\u542b\u4e49\u4e0e\u8f93\u5165\u8f93\u51fa\u5e93\uff08stdio\uff09"}]},{"@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\/113305","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=113305"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/113305\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/113298"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=113305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=113305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=113305"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=113305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}