{"id":45146,"date":"2023-09-28T22:34:44","date_gmt":"2023-09-28T14:34:44","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=45146"},"modified":"2023-09-28T22:34:44","modified_gmt":"2023-09-28T14:34:44","slug":"pypdqb-3","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/45146.html","title":{"rendered":"printf\u4e0eputchar\u7684\u533a\u522b"},"content":{"rendered":"
printf\u548cputchar\u90fd\u662fC\u8bed\u8a00\u4e2d\u7684\u51fd\u6570\uff0c\u5b83\u4eec\u90fd\u53ef\u4ee5\u7528\u6765\u5728\u5c4f\u5e55\u4e0a\u8f93\u51fa\u5b57\u7b26\uff0c\u4f46\u5b83\u4eec\u7684\u529f\u80fd\u6709\u6240\u4e0d\u540c\u3002\u672c\u6587\u5c06\u8ba8\u8bbaprintf\u4e0eputchar\u4e4b\u95f4\u7684\u533a\u522b\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u7528\u6cd5\u3002<\/p>\n
printf\u662f\u4e00\u4e2a\u7528\u4e8e\u683c\u5f0f\u5316\u8f93\u51fa\u7684\u51fd\u6570\uff0c\u5b83\u53ef\u4ee5\u5c06\u4efb\u4f55\u7c7b\u578b\u7684\u6570\u636e\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff0c\u5e76\u5c06\u5176\u8f93\u51fa\u5230\u5c4f\u5e55\u4e0a\u3002\u5b83\u53ef\u4ee5\u63a5\u53d7\u4efb\u610f\u7c7b\u578b\u7684\u53c2\u6570\uff0c\u5e76\u5c06\u5b83\u4eec\u683c\u5f0f\u5316\u8f93\u51fa\uff0c\u6bd4\u5982\uff1a<\/p>\n
printf\u53ef\u4ee5\u7528\u6765\u683c\u5f0f\u5316\u8f93\u51fa\u6570\u5b57\uff0c\u4f8b\u5982\uff1a<\/p>\n
printf(\"The number is %d\", 5);<\/p><\/pre>\n
\u8f93\u51fa\uff1aThe number is 5<\/p>\n
\u683c\u5f0f\u5316\u8f93\u51fa\u5b57\u7b26\u4e32<\/h3>\n
printf\u4e5f\u53ef\u4ee5\u7528\u6765\u683c\u5f0f\u5316\u8f93\u51fa\u5b57\u7b26\u4e32\uff0c\u4f8b\u5982\uff1a<\/p>\n
printf(\"The string is %s\", \"Hello World\");<\/p><\/pre>\n
\u8f93\u51fa\uff1aThe string is Hello World<\/p>\n
putchar\u7684\u4f7f\u7528<\/h2>\n
putchar\u662f\u4e00\u4e2a\u7528\u4e8e\u8f93\u51fa\u5355\u4e2a\u5b57\u7b26\u7684\u51fd\u6570\uff0c\u5b83\u53ea\u80fd\u63a5\u53d7\u4e00\u4e2a\u5b57\u7b26\u4f5c\u4e3a\u53c2\u6570\uff0c\u5e76\u5c06\u5176\u8f93\u51fa\u5230\u5c4f\u5e55\u4e0a\u3002\u4f8b\u5982\uff1a<\/p>\n
putchar('A');<\/p><\/pre>\n
\u8f93\u51fa\uff1aA<\/p>\n
printf\u4e0eputchar\u7684\u533a\u522b<\/h2>\n
printf\u548cputchar\u7684\u6700\u5927\u533a\u522b\u5728\u4e8e\u5b83\u4eec\u53ef\u4ee5\u63a5\u53d7\u7684\u53c2\u6570\u7c7b\u578b\u4e0d\u540c\u3002printf\u53ef\u4ee5\u63a5\u53d7\u4efb\u610f\u7c7b\u578b\u7684\u53c2\u6570\uff0c\u5e76\u5c06\u5176\u683c\u5f0f\u5316\u8f93\u51fa\uff0c\u800cputchar\u53ea\u80fd\u63a5\u53d7\u5355\u4e2a\u5b57\u7b26\u4f5c\u4e3a\u53c2\u6570\uff0c\u5e76\u5c06\u5176\u8f93\u51fa\u5230\u5c4f\u5e55\u4e0a\u3002\u53e6\u5916\uff0cprintf\u53ef\u4ee5\u7528\u6765\u683c\u5f0f\u5316\u8f93\u51fa\u590d\u6742\u7684\u5b57\u7b26\u4e32\uff0c\u800cputchar\u53ea\u80fd\u7528\u6765\u8f93\u51fa\u5355\u4e2a\u5b57\u7b26\u3002<\/p>\n
\u603b\u7ed3<\/h2>\n
printf\u548cputchar\u662fC\u8bed\u8a00\u4e2d\u7684\u5e38\u7528\u51fd\u6570\uff0c\u5b83\u4eec\u90fd\u53ef\u4ee5\u7528\u6765\u5728\u5c4f\u5e55\u4e0a\u8f93\u51fa\u5b57\u7b26\u3002<\/strong>\u5b83\u4eec\u7684\u6700\u5927\u533a\u522b\u5728\u4e8e\u5b83\u4eec\u53ef\u4ee5\u63a5\u53d7\u7684\u53c2\u6570\u7c7b\u578b\u4e0d\u540c\uff1aprintf\u53ef\u4ee5\u63a5\u53d7\u4efb\u610f\u7c7b\u578b\u7684\u53c2\u6570\uff0c\u5e76\u5c06\u5176\u683c\u5f0f\u5316\u8f93\u51fa\uff0c\u800cputchar\u53ea\u80fd\u63a5\u53d7\u5355\u4e2a\u5b57\u7b26\u4f5c\u4e3a\u53c2\u6570\uff0c\u5e76\u5c06\u5176\u8f93\u51fa\u5230\u5c4f\u5e55\u4e0a\u3002\u56e0\u6b64\uff0cprintf\u53ef\u4ee5\u7528\u6765\u683c\u5f0f\u5316\u8f93\u51fa\u590d\u6742\u7684\u5b57\u7b26\u4e32\uff0c\u800cputchar\u53ea\u80fd\u7528\u6765\u8f93\u51fa\u5355\u4e2a\u5b57\u7b26\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
printf\u548cputchar\u90fd\u662fC\u8bed\u8a00\u4e2d\u7684\u51fd\u6570\uff0c\u5b83\u4eec\u90fd\u53ef\u4ee5\u7528\u6765\u5728\u5c4f\u5e55\u4e0a\u8f93\u51fa\u5b57\u7b26\uff0c\u4f46\u5b83\u4eec\u7684\u529f\u80fd\u6709\u6240\u4e0d\u540c\u3002\u672c\u6587\u5c06\u8ba8\u8bbaprintf\u4e0eputchar\u4e4b\u95f4\u7684\u533a\u522b\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u7528\u6cd5\u3002<\/p>\n","protected":false},"author":1,"featured_media":4132,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[305],"class_list":["post-45146","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-dzjs"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/45146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/comments?post=45146"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/45146\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/4132"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=45146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=45146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=45146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}