{"id":1090,"date":"2026-04-25T22:54:02","date_gmt":"2026-04-25T14:54:02","guid":{"rendered":"http:\/\/wordpress.fangt.online\/?p=1090"},"modified":"2026-05-23T15:48:50","modified_gmt":"2026-05-23T07:48:50","slug":"%e5%ad%97%e7%ac%a6%e6%95%b0%e7%bb%84%e5%9f%ba%e6%9c%ac%e7%94%a8%e6%b3%95","status":"publish","type":"post","link":"http:\/\/wordpress.fangt.online\/index.php\/2026\/04\/25\/%e5%ad%97%e7%ac%a6%e6%95%b0%e7%bb%84%e5%9f%ba%e6%9c%ac%e7%94%a8%e6%b3%95\/","title":{"rendered":"\u5b57\u7b26\u6570\u7ec4\u57fa\u672c\u7528\u6cd5"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">\u5b57\u7b26\u6570\u7ec4\u5c31\u662f\u5b57\u7b26\u7c7b\u578b\u7684\u6570\u7ec4\uff0c\u4e0e\u6574\u6570\u578b\u6570\u7ec4\u7684\u7528\u6cd5\u5b8c\u5168\u76f8\u540c<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream&gt;\nusing namespace std;\n\nint main()\n{\n\t\/\/ \u5b57\u7b26\u6570\u7ec4\u521d\u59cb\u5316\n\tchar c&#91;5];\n\tchar d&#91;5]={'a','b','c','d','e'};\n\tchar e&#91;]={'a','b','c','d','e'}; \/\/ \u81ea\u52a8\u8ba1\u7b97\u957f\u5ea6\n\t\n\t\n\t\/\/ \u5b57\u7b26\u6570\u7ec4\u57fa\u672c\u8f93\u5165\u8f93\u51fa\n\tchar f&#91;1000]={};\n\tint n;\n\tcin&gt;&gt;n;\n\tfor(int i=0;i&lt;n;i++){\n\t\tcin&gt;&gt;f&#91;i];\n\t}\n\tfor(int i=0;i&lt;n;i++){\n\t\tcout&lt;&lt;f&#91;i]&lt;&lt;\" \";\n\t}\n\t\n    return 0;\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u7b26\u6570\u7ec4\u72ec\u6709\u7684\u7528\u6cd5<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream>\nusing namespace std;\n\nint main()\n{\n\t\/\/ \u5b57\u7b26\u6570\u7ec4\u521d\u59cb\u5316\n\tchar c&#91;6] = {'h','e','l','l','o','\\0'}; \/\/ '\\0'\u4f5c\u4e3a\u7ed3\u675f\u6807\u8bb0\uff0c\u5360\u4f4d\u786e\u4e0d\u7b97\u957f\u5ea6\n\t\n\tchar d&#91;] = \"hello\"; \/\/ \u5c06\u6bcf\u4e2a\u5b57\u7b26\u4e00\u4e00\u5b58\u653e\u8fdb\u6570\u7ec4\u4e2d\uff08\u5305\u542b'\\0'\uff09\uff0c\u81ea\u52a8\u8ba1\u7b97\u957f\u5ea6\n\t\n\t\/\/ \u5b57\u7b26\u6570\u7ec4\u9ad8\u7ea7\u8f93\u5165\u8f93\u51fa\n\tchar e&#91;10];\n\tcin>>e; \/\/ \u6574\u884c\u8f93\u5165\uff0c\u4e00\u4e00\u5b58\u653e\uff0c\u9047\u5230\u7a7a\u683c\u6216\u6362\u884c\u7ed3\u675f\n\tcout&lt;&lt;e; \/\/ \u8f93\u51fa\u6574\u884c\uff0c\u9047\u5230'\\0'\u7ed3\u675f\n\t\n        cin.ignore();\n\tcin.getline(e,10); \/\/ \u6574\u884c\u8f93\u5165\uff0c\u5305\u62ec\u7a7a\u683c\n\t\n    return 0;\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u7b26\u6570\u7ec4\u76f8\u5173\u7684\u529f\u80fd\u51fd\u6570<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">strlen (arr) \u2014\u2014 \u6c42\u5b57\u7b26\u4e32\u957f\u5ea6\uff08\u4e0d\u542b \\0\uff09<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>char c&#91;] = \"abcde\";\nint len = strlen(c);\ncout&lt;&lt;len; \/\/ 5<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">strcmp (arr1, arr2) \u2014\u2014 \u6bd4\u8f83\u4e24\u4e2a\u5b57\u7b26\u4e32ascii\u7801<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>char c1&#91;]=\"abc\";\nchar c2&#91;]=\"123\";\nint res = strcmp(c1,c2);\ncout&lt;&lt;res; \/\/ \u6b63\u6570c1\u5927\uff0c\u8d1f\u6570c2\u5927\uff0c0\u4e00\u6837\u5927<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">strcat (arr1, arr2) \u2014\u2014 \u5b57\u7b26\u4e32\u62fc\u63a5<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>char c1&#91;50]=\"abc\";\nchar c2&#91;]=\"123\";\nstrcat(c1,c2); \/\/ \u62fc\u63a5\u65f6\uff0cc1\u9700\u8981\u6709\u8db3\u591f\u7684\u7a7a\u95f4\ncout&lt;&lt;c1; \/\/ \"abc123\"<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5b57\u7b26\u6570\u7ec4\u5c31\u662f\u5b57\u7b26\u7c7b\u578b\u7684\u6570\u7ec4\uff0c\u4e0e\u6574\u6570\u578b\u6570\u7ec4\u7684\u7528\u6cd5\u5b8c\u5168\u76f8\u540c \u5b57\u7b26\u6570\u7ec4\u72ec\u6709\u7684\u7528\u6cd5 \u5b57\u7b26\u6570\u7ec4\u76f8\u5173\u7684\u529f\u80fd\u51fd\u6570 strle [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[],"class_list":["post-1090","post","type-post","status-publish","format-standard","hentry","category-zl"],"_links":{"self":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts\/1090","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/comments?post=1090"}],"version-history":[{"count":2,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts\/1090\/revisions"}],"predecessor-version":[{"id":1613,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts\/1090\/revisions\/1613"}],"wp:attachment":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/media?parent=1090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/categories?post=1090"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/tags?post=1090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}