{"id":66172,"date":"2026-01-26T11:48:59","date_gmt":"2026-01-26T03:48:59","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/66172.html"},"modified":"2026-01-26T11:48:59","modified_gmt":"2026-01-26T03:48:59","slug":"c%e8%af%ad%e8%a8%8014%e7%ab%a0%e9%9b%b6%e5%9f%ba%e7%a1%80%e5%b9%b2%e8%b4%a7-%e7%ac%ac%e5%85%ad%e7%ab%a0","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/66172.html","title":{"rendered":"C\u8bed\u8a0014\u7ae0\u96f6\u57fa\u7840\u5e72\u8d27 \u7b2c\u516d\u7ae0"},"content":{"rendered":"<h2>\u7b2c6\u7ae0 \u51fd\u6570<\/h2>\n<h3>6.1 \u51fd\u6570\u6982\u8ff0<\/h3>\n<p>\u51fd\u6570\u662fC\u8bed\u8a00\u4e2d\u6a21\u5757\u5316\u7f16\u7a0b\u7684\u57fa\u672c\u5355\u4f4d&#xff0c;\u5b83\u662f\u4e00\u4e2a\u5b8c\u6210\u7279\u5b9a\u529f\u80fd\u7684\u4ee3\u7801\u5757&#xff0c;\u53ef\u4ee5\u88ab\u91cd\u590d\u8c03\u7528\u3002\u51fd\u6570\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u590d\u7528\u6027\u3001\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<p>\u51fd\u6570\u7684\u7279\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u51fd\u6570\u662f\u4e00\u4e2a\u72ec\u7acb\u7684\u4ee3\u7801\u5757&#xff0c;\u5b8c\u6210\u7279\u5b9a\u7684\u529f\u80fd<\/li>\n<li>\u51fd\u6570\u53ef\u4ee5\u88ab\u591a\u6b21\u8c03\u7528&#xff0c;\u63d0\u9ad8\u4ee3\u7801\u7684\u590d\u7528\u6027<\/li>\n<li>\u51fd\u6570\u53ef\u4ee5\u63a5\u6536\u8f93\u5165\u53c2\u6570&#xff0c;\u5e76\u8fd4\u56de\u8f93\u51fa\u7ed3\u679c<\/li>\n<li>\u51fd\u6570\u53ef\u4ee5\u9690\u85cf\u5185\u90e8\u5b9e\u73b0\u7ec6\u8282&#xff0c;\u53ea\u66b4\u9732\u63a5\u53e3<\/li>\n<\/ul>\n<p>C\u8bed\u8a00\u4e2d\u7684\u51fd\u6570\u5206\u7c7b&#xff1a;<\/p>\n<ul>\n<li>\u5e93\u51fd\u6570&#xff1a;\u7531C\u8bed\u8a00\u6807\u51c6\u5e93\u63d0\u4f9b\u7684\u51fd\u6570&#xff0c;\u5982printf\u3001scanf\u7b49<\/li>\n<li>\u7528\u6237\u81ea\u5b9a\u4e49\u51fd\u6570&#xff1a;\u7531\u7528\u6237\u81ea\u5df1\u7f16\u5199\u7684\u51fd\u6570&#xff0c;\u7528\u4e8e\u5b9e\u73b0\u7279\u5b9a\u7684\u529f\u80fd<\/li>\n<\/ul>\n<h3>6.2 \u51fd\u6570\u7684\u5b9a\u4e49\u548c\u58f0\u660e<\/h3>\n<h4>6.2.1 \u51fd\u6570\u7684\u5b9a\u4e49<\/h4>\n<p>\u51fd\u6570\u5b9a\u4e49\u662f\u6307\u7f16\u5199\u51fd\u6570\u7684\u5177\u4f53\u5b9e\u73b0\u4ee3\u7801\u3002<\/p>\n<p>\u51fd\u6570\u5b9a\u4e49\u7684\u8bed\u6cd5&#xff1a;<\/p>\n<p>\u8fd4\u56de\u503c\u7c7b\u578b \u51fd\u6570\u540d(\u53c2\u6570\u5217\u8868) {<br \/>\n    \/\/ \u51fd\u6570\u4f53&#xff1a;\u5b9e\u73b0\u51fd\u6570\u529f\u80fd\u7684\u4ee3\u7801<br \/>\n    return \u8fd4\u56de\u503c;  \/\/ \u53ef\u9009&#xff0c;\u53d6\u51b3\u4e8e\u8fd4\u56de\u503c\u7c7b\u578b<br \/>\n}<\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<ul>\n<li>\u8fd4\u56de\u503c\u7c7b\u578b&#xff1a;\u51fd\u6570\u8fd4\u56de\u503c\u7684\u6570\u636e\u7c7b\u578b&#xff0c;\u5982\u679c\u51fd\u6570\u4e0d\u8fd4\u56de\u503c&#xff0c;\u4f7f\u7528void<\/li>\n<li>\u51fd\u6570\u540d&#xff1a;\u51fd\u6570\u7684\u540d\u79f0&#xff0c;\u9075\u5faa\u53d8\u91cf\u547d\u540d\u89c4\u5219<\/li>\n<li>\u53c2\u6570\u5217\u8868&#xff1a;\u51fd\u6570\u63a5\u6536\u7684\u8f93\u5165\u53c2\u6570&#xff0c;\u6bcf\u4e2a\u53c2\u6570\u7531\u6570\u636e\u7c7b\u578b\u548c\u53c2\u6570\u540d\u7ec4\u6210&#xff0c;\u591a\u4e2a\u53c2\u6570\u4e4b\u95f4\u7528\u9017\u53f7\u5206\u9694<\/li>\n<li>\u51fd\u6570\u4f53&#xff1a;\u5b9e\u73b0\u51fd\u6570\u529f\u80fd\u7684\u4ee3\u7801\u5757<\/li>\n<li>return\u8bed\u53e5&#xff1a;\u7528\u4e8e\u8fd4\u56de\u51fd\u6570\u7684\u7ed3\u679c&#xff0c;\u7ed3\u675f\u51fd\u6570\u7684\u6267\u884c<\/li>\n<\/ul>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>\/\/ \u5b9a\u4e49\u4e00\u4e2a\u8ba1\u7b97\u4e24\u4e2a\u6574\u6570\u548c\u7684\u51fd\u6570<br \/>\nint add(int a, int b) {<br \/>\n    int sum &#061; a &#043; b;<br \/>\n    return sum;  \/\/ \u8fd4\u56de\u4e24\u4e2a\u6570\u7684\u548c<br \/>\n}<\/p>\n<p>\/\/ \u5b9a\u4e49\u4e00\u4e2a\u6253\u5370\u95ee\u5019\u8bed\u7684\u51fd\u6570&#xff0c;\u65e0\u8fd4\u56de\u503c<br \/>\nvoid greet() {<br \/>\n    printf(&#034;Hello, World!\\\\n&#034;);<br \/>\n    \/\/ \u6ca1\u6709return\u8bed\u53e5&#xff0c;\u6216\u8005\u4f7f\u7528return;<br \/>\n}<\/p>\n<h4>6.2.2 \u51fd\u6570\u7684\u58f0\u660e<\/h4>\n<p>\u51fd\u6570\u58f0\u660e\u662f\u6307\u544a\u8bc9\u7f16\u8bd1\u5668\u51fd\u6570\u7684\u5b58\u5728&#xff0c;\u5305\u62ec\u51fd\u6570\u540d\u3001\u8fd4\u56de\u503c\u7c7b\u578b\u548c\u53c2\u6570\u5217\u8868&#xff0c;\u800c\u4e0d\u5305\u542b\u51fd\u6570\u4f53\u3002\u51fd\u6570\u58f0\u660e\u7684\u76ee\u7684\u662f\u4e3a\u4e86\u8ba9\u7f16\u8bd1\u5668\u5728\u7f16\u8bd1\u65f6\u80fd\u591f\u8bc6\u522b\u51fd\u6570\u8c03\u7528\u3002<\/p>\n<p>\u51fd\u6570\u58f0\u660e\u7684\u8bed\u6cd5&#xff1a;<\/p>\n<p>\u8fd4\u56de\u503c\u7c7b\u578b \u51fd\u6570\u540d(\u53c2\u6570\u5217\u8868);<\/p>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>\/\/ \u58f0\u660e\u4e00\u4e2a\u8ba1\u7b97\u4e24\u4e2a\u6574\u6570\u548c\u7684\u51fd\u6570<br \/>\nint add(int a, int b);<\/p>\n<p>\/\/ \u58f0\u660e\u4e00\u4e2a\u6253\u5370\u95ee\u5019\u8bed\u7684\u51fd\u6570<br \/>\nvoid greet();<\/p>\n<h4>\u6ce8\u610f\u4e8b\u9879<\/h4>\n<ul>\n<li>\u51fd\u6570\u58f0\u660e\u53ef\u4ee5\u7701\u7565\u53c2\u6570\u540d&#xff0c;\u53ea\u4fdd\u7559\u53c2\u6570\u7c7b\u578b&#xff0c;\u5982int add(int, int);<\/li>\n<li>\u51fd\u6570\u58f0\u660e\u5fc5\u987b\u5728\u51fd\u6570\u8c03\u7528\u4e4b\u524d<\/li>\n<li>\u5982\u679c\u51fd\u6570\u5b9a\u4e49\u5728\u51fd\u6570\u8c03\u7528\u4e4b\u524d&#xff0c;\u53ef\u4ee5\u7701\u7565\u51fd\u6570\u58f0\u660e<\/li>\n<\/ul>\n<h4>6.2.3 \u51fd\u6570\u5b9a\u4e49\u548c\u58f0\u660e\u7684\u5173\u7cfb<\/h4>\n<p>\u51fd\u6570\u58f0\u660e\u662f\u51fd\u6570\u5b9a\u4e49\u7684\u201c\u539f\u578b\u201d&#xff0c;\u5b83\u544a\u8bc9\u7f16\u8bd1\u5668\u51fd\u6570\u7684\u63a5\u53e3\u4fe1\u606f&#xff0c;\u800c\u51fd\u6570\u5b9a\u4e49\u5219\u63d0\u4f9b\u4e86\u51fd\u6570\u7684\u5177\u4f53\u5b9e\u73b0\u3002<\/p>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>\/\/ \u51fd\u6570\u58f0\u660e<br \/>\nint add(int a, int b);<br \/>\nvoid greet();<\/p>\n<p>int main() {<br \/>\n    greet();  \/\/ \u8c03\u7528greet\u51fd\u6570<\/p>\n<p>    int num1 &#061; 5, num2 &#061; 3;<br \/>\n    int result &#061; add(num1, num2);  \/\/ \u8c03\u7528add\u51fd\u6570<br \/>\n    printf(&#034;%d &#043; %d &#061; %d\\\\n&#034;, num1, num2, result);<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\/\/ \u51fd\u6570\u5b9a\u4e49<br \/>\nint add(int a, int b) {<br \/>\n    int sum &#061; a &#043; b;<br \/>\n    return sum;<br \/>\n}<\/p>\n<p>\/\/ \u51fd\u6570\u5b9a\u4e49<br \/>\nvoid greet() {<br \/>\n    printf(&#034;Hello, World!\\\\n&#034;);<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>Hello, World!<br \/>\n5 &#043; 3 &#061; 8<\/p>\n<h5>\u7ae0\u8282\u7ec3\u4e60&#xff1a;\u51fd\u6570\u7684\u5b9a\u4e49\u548c\u8c03\u7528<\/h5>\n<p>\u7f16\u5199\u4e00\u4e2a\u7a0b\u5e8f&#xff0c;\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\u6765\u8ba1\u7b97\u4e24\u4e2a\u6574\u6570\u7684\u4e58\u79ef&#xff0c;\u7136\u540e\u5728main\u51fd\u6570\u4e2d\u8c03\u7528\u8be5\u51fd\u6570&#xff0c;\u8f93\u5165\u4e24\u4e2a\u6574\u6570&#xff0c;\u8f93\u51fa\u5b83\u4eec\u7684\u4e58\u79ef\u3002<\/p>\n<h5>\u7591\u96be\u89e3\u6790&#xff1a;\u51fd\u6570\u58f0\u660e\u548c\u51fd\u6570\u5b9a\u4e49\u7684\u533a\u522b\u662f\u4ec0\u4e48&#xff1f;<\/h5>\n<p>\u51fd\u6570\u58f0\u660e\u548c\u51fd\u6570\u5b9a\u4e49\u662fC\u8bed\u8a00\u4e2d\u4e24\u4e2a\u4e0d\u540c\u7684\u6982\u5ff5&#xff1a;<\/p>\n<ul>\n<li>\u51fd\u6570\u58f0\u660e&#xff1a;\u544a\u8bc9\u7f16\u8bd1\u5668\u51fd\u6570\u7684\u5b58\u5728&#xff0c;\u5305\u62ec\u51fd\u6570\u540d\u3001\u8fd4\u56de\u503c\u7c7b\u578b\u548c\u53c2\u6570\u5217\u8868&#xff0c;\u4f46\u4e0d\u5305\u542b\u51fd\u6570\u4f53\u3002\u51fd\u6570\u58f0\u660e\u7684\u76ee\u7684\u662f\u4e3a\u4e86\u8ba9\u7f16\u8bd1\u5668\u5728\u7f16\u8bd1\u65f6\u80fd\u591f\u8bc6\u522b\u51fd\u6570\u8c03\u7528\u3002<\/li>\n<li>\u51fd\u6570\u5b9a\u4e49&#xff1a;\u5305\u542b\u51fd\u6570\u7684\u5b8c\u6574\u5b9e\u73b0&#xff0c;\u5305\u62ec\u51fd\u6570\u4f53\u3002\u51fd\u6570\u5b9a\u4e49\u662f\u51fd\u6570\u7684\u5177\u4f53\u5b9e\u73b0\u4ee3\u7801\u3002<\/li>\n<\/ul>\n<p>\u4e00\u4e2a\u51fd\u6570\u53ef\u4ee5\u6709\u591a\u4e2a\u58f0\u660e&#xff0c;\u4f46\u53ea\u80fd\u6709\u4e00\u4e2a\u5b9a\u4e49&#xff08;\u5355\u4e00\u5b9a\u4e49\u89c4\u5219&#xff09;\u3002<\/p>\n<\/p>\n<h5>\u6613\u9519\u90e8\u5206&#xff1a;\u51fd\u6570\u5b9a\u4e49\u987a\u5e8f\u9519\u8bef<\/h5>\n<p>\u5728C\u8bed\u8a00\u4e2d&#xff0c;\u5982\u679c\u51fd\u6570\u5b9a\u4e49\u5728\u51fd\u6570\u8c03\u7528\u4e4b\u540e&#xff0c;\u5fc5\u987b\u5148\u58f0\u660e\u8be5\u51fd\u6570&#xff0c;\u5426\u5219\u7f16\u8bd1\u5668\u4f1a\u62a5\u9519\u3002\u4f8b\u5982&#xff1a;<\/p>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>int main() {<br \/>\n    int result &#061; add(5, 3);  \/\/ \u9519\u8bef&#xff1a;add\u51fd\u6570\u5c1a\u672a\u58f0\u660e<br \/>\n    printf(&#034;%d\\\\n&#034;, result);<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\/\/ \u51fd\u6570\u5b9a\u4e49\u5728\u8c03\u7528\u4e4b\u540e<br \/>\nint add(int a, int b) {<br \/>\n    return a &#043; b;<br \/>\n}<\/p>\n<p>\u6b63\u786e\u7684\u505a\u6cd5\u662f\u5728main\u51fd\u6570\u4e4b\u524d\u58f0\u660eadd\u51fd\u6570&#xff0c;\u6216\u8005\u5c06add\u51fd\u6570\u7684\u5b9a\u4e49\u653e\u5728main\u51fd\u6570\u4e4b\u524d\u3002<\/p>\n<\/p>\n<h5>\u7ae0\u8282\u8da3\u4e8b&#xff1a;\u51fd\u6570\u7684\u5386\u53f2<\/h5>\n<p>\u51fd\u6570\u7684\u6982\u5ff5\u6700\u65e9\u53ef\u4ee5\u8ffd\u6eaf\u5230\u6570\u5b66\u4e2d\u7684\u51fd\u6570&#xff0c;\u5b83\u8868\u793a\u4e00\u79cd\u8f93\u5165\u8f93\u51fa\u5173\u7cfb\u3002\u5728\u7f16\u7a0b\u8bed\u8a00\u4e2d&#xff0c;\u51fd\u6570\u7684\u6982\u5ff5\u662f\u7531\u65e9\u671f\u7684\u7f16\u7a0b\u8bed\u8a00\u5982FORTRAN\u548cALGOL 60\u5f15\u5165\u7684\u3002C\u8bed\u8a00\u7ee7\u627f\u548c\u53d1\u5c55\u4e86\u51fd\u6570\u7684\u6982\u5ff5&#xff0c;\u4f7f\u5176\u6210\u4e3a\u6a21\u5757\u5316\u7f16\u7a0b\u7684\u57fa\u672c\u5355\u4f4d\u3002\u73b0\u4ee3\u7f16\u7a0b\u8bed\u8a00\u5982C&#043;&#043;\u3001Java\u3001Python\u7b49\u90fd\u4fdd\u7559\u4e86\u51fd\u6570\u7684\u6982\u5ff5&#xff0c;\u5e76\u5728\u6b64\u57fa\u7840\u4e0a\u8fdb\u884c\u4e86\u6269\u5c55&#xff0c;\u5982\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u4e2d\u7684\u65b9\u6cd5\u3002<\/p>\n<h3>6.3 \u51fd\u6570\u53c2\u6570\u548c\u8fd4\u56de\u503c<\/h3>\n<h4>6.3.1 \u51fd\u6570\u53c2\u6570<\/h4>\n<p>\u51fd\u6570\u53c2\u6570\u662f\u51fd\u6570\u63a5\u6536\u7684\u8f93\u5165\u503c&#xff0c;\u7528\u4e8e\u4f20\u9012\u6570\u636e\u7ed9\u51fd\u6570\u3002\u51fd\u6570\u53c2\u6570\u5206\u4e3a\u5f62\u53c2\u548c\u5b9e\u53c2\u3002<\/p>\n<h5>1. \u5f62\u53c2<\/h5>\n<p>\u5f62\u53c2&#xff08;\u5f62\u5f0f\u53c2\u6570&#xff09;\u662f\u51fd\u6570\u5b9a\u4e49\u65f6\u62ec\u53f7\u4e2d\u7684\u53c2\u6570&#xff0c;\u5b83\u662f\u51fd\u6570\u5185\u90e8\u7684\u5c40\u90e8\u53d8\u91cf&#xff0c;\u7528\u4e8e\u63a5\u6536\u5b9e\u53c2\u4f20\u9012\u7684\u503c\u3002<\/p>\n<h5>2. \u5b9e\u53c2<\/h5>\n<p>\u5b9e\u53c2&#xff08;\u5b9e\u9645\u53c2\u6570&#xff09;\u662f\u51fd\u6570\u8c03\u7528\u65f6\u4f20\u9012\u7ed9\u51fd\u6570\u7684\u503c&#xff0c;\u5b83\u53ef\u4ee5\u662f\u5e38\u91cf\u3001\u53d8\u91cf\u6216\u8868\u8fbe\u5f0f\u3002<\/p>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>int add(int a, int b) {  \/\/ a\u548cb\u662f\u5f62\u53c2<br \/>\n    return a &#043; b;<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    int x &#061; 5, y &#061; 3;<br \/>\n    int result &#061; add(x, y);  \/\/ x\u548cy\u662f\u5b9e\u53c2<br \/>\n    return 0;<br \/>\n}<\/p>\n<h4>6.3.2 \u53c2\u6570\u4f20\u9012\u65b9\u5f0f<\/h4>\n<p>C\u8bed\u8a00\u4e2d&#xff0c;\u51fd\u6570\u53c2\u6570\u7684\u4f20\u9012\u65b9\u5f0f\u662f\u503c\u4f20\u9012&#xff0c;\u5373\u5b9e\u53c2\u7684\u503c\u88ab\u590d\u5236\u5230\u5f62\u53c2\u4e2d&#xff0c;\u51fd\u6570\u5185\u90e8\u5bf9\u5f62\u53c2\u7684\u4fee\u6539\u4e0d\u4f1a\u5f71\u54cd\u5b9e\u53c2\u7684\u503c\u3002<\/p>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>void swap(int a, int b) {<br \/>\n    int temp &#061; a;<br \/>\n    a &#061; b;<br \/>\n    b &#061; temp;<br \/>\n    printf(&#034;swap\u51fd\u6570\u4e2d: a &#061; %d, b &#061; %d\\\\n&#034;, a, b);<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    int x &#061; 5, y &#061; 3;<br \/>\n    printf(&#034;\u4ea4\u6362\u524d: x &#061; %d, y &#061; %d\\\\n&#034;, x, y);<br \/>\n    swap(x, y);  \/\/ \u503c\u4f20\u9012<br \/>\n    printf(&#034;\u4ea4\u6362\u540e: x &#061; %d, y &#061; %d\\\\n&#034;, x, y);  \/\/ x\u548cy\u7684\u503c\u6ca1\u6709\u6539\u53d8<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>\u4ea4\u6362\u524d: x &#061; 5, y &#061; 3<br \/>\nswap\u51fd\u6570\u4e2d: a &#061; 3, b &#061; 5<br \/>\n\u4ea4\u6362\u540e: x &#061; 5, y &#061; 3<\/p>\n<h4>\u6ce8\u610f\u4e8b\u9879<\/h4>\n<p>\u503c\u4f20\u9012\u7684\u7279\u70b9\u662f&#xff1a;\u51fd\u6570\u5185\u90e8\u5bf9\u5f62\u53c2\u7684\u4fee\u6539\u4e0d\u4f1a\u5f71\u54cd\u5b9e\u53c2\u7684\u503c\u3002\u5982\u679c\u9700\u8981\u5728\u51fd\u6570\u5185\u90e8\u4fee\u6539\u5b9e\u53c2\u7684\u503c&#xff0c;\u9700\u8981\u4f7f\u7528\u6307\u9488\u4f20\u9012&#xff08;\u540e\u7eed\u7ae0\u8282\u4f1a\u8be6\u7ec6\u8bb2\u89e3&#xff09;\u3002<\/p>\n<h4>6.3.3 \u8fd4\u56de\u503c<\/h4>\n<p>\u8fd4\u56de\u503c\u662f\u51fd\u6570\u6267\u884c\u540e\u8fd4\u56de\u7ed9\u8c03\u7528\u8005\u7684\u7ed3\u679c\u3002<\/p>\n<p>\u4f7f\u7528return\u8bed\u53e5\u8fd4\u56de\u503c&#xff1a;<\/p>\n<ul>\n<li>\u5982\u679c\u51fd\u6570\u6709\u8fd4\u56de\u503c&#xff0c;return\u8bed\u53e5\u5fc5\u987b\u8fd4\u56de\u4e00\u4e2a\u4e0e\u8fd4\u56de\u503c\u7c7b\u578b\u5339\u914d\u7684\u503c<\/li>\n<li>\u5982\u679c\u51fd\u6570\u7684\u8fd4\u56de\u503c\u7c7b\u578b\u662fvoid&#xff0c;return\u8bed\u53e5\u53ef\u4ee5\u7701\u7565&#xff0c;\u6216\u8005\u4f7f\u7528return;\u7ed3\u675f\u51fd\u6570<\/li>\n<li>return\u8bed\u53e5\u4f1a\u7acb\u5373\u7ed3\u675f\u51fd\u6570\u7684\u6267\u884c&#xff0c;\u8fd4\u56de\u5230\u8c03\u7528\u4f4d\u7f6e<\/li>\n<\/ul>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>\/\/ \u6709\u8fd4\u56de\u503c\u7684\u51fd\u6570<br \/>\nint max(int a, int b) {<br \/>\n    if (a &gt; b) {<br \/>\n        return a;  \/\/ \u8fd4\u56dea\u7684\u503c&#xff0c;\u7ed3\u675f\u51fd\u6570<br \/>\n    } else {<br \/>\n        return b;  \/\/ \u8fd4\u56deb\u7684\u503c&#xff0c;\u7ed3\u675f\u51fd\u6570<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ \u65e0\u8fd4\u56de\u503c\u7684\u51fd\u6570<br \/>\nvoid print_number(int num) {<br \/>\n    if (num &lt; 0) {<br \/>\n        printf(&#034;\u8d1f\u6570\\\\n&#034;);<br \/>\n        return;  \/\/ \u63d0\u524d\u7ed3\u675f\u51fd\u6570<br \/>\n    }<br \/>\n    printf(&#034;\u6b63\u6570\u6216\u96f6: %d\\\\n&#034;, num);<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    int x &#061; 5, y &#061; 3;<br \/>\n    int m &#061; max(x, y);<br \/>\n    printf(&#034;\u6700\u5927\u503c: %d\\\\n&#034;, m);<\/p>\n<p>    print_number(-5);<br \/>\n    print_number(10);<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>\u6700\u5927\u503c: 5<br \/>\n\u8d1f\u6570<br \/>\n\u6b63\u6570\u6216\u96f6: 10<\/p>\n<h3>6.4 \u51fd\u6570\u8c03\u7528<\/h3>\n<p>\u51fd\u6570\u8c03\u7528\u662f\u6307\u6267\u884c\u51fd\u6570\u4f53\u4e2d\u7684\u4ee3\u7801&#xff0c;\u83b7\u53d6\u51fd\u6570\u7684\u8fd4\u56de\u503c&#xff08;\u5982\u679c\u6709&#xff09;\u3002<\/p>\n<h4>6.4.1 \u51fd\u6570\u8c03\u7528\u7684\u8bed\u6cd5<\/h4>\n<p>\/\/ \u5982\u679c\u51fd\u6570\u6709\u8fd4\u56de\u503c&#xff0c;\u53ef\u4ee5\u5c06\u8fd4\u56de\u503c\u8d4b\u7ed9\u53d8\u91cf<br \/>\n\u8fd4\u56de\u503c\u7c7b\u578b \u53d8\u91cf\u540d &#061; \u51fd\u6570\u540d(\u5b9e\u53c2\u5217\u8868);<\/p>\n<p>\/\/ \u6216\u8005\u76f4\u63a5\u8c03\u7528&#xff0c;\u5ffd\u7565\u8fd4\u56de\u503c<br \/>\n\u51fd\u6570\u540d(\u5b9e\u53c2\u5217\u8868);<\/p>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>int add(int a, int b) {<br \/>\n    return a &#043; b;<br \/>\n}<\/p>\n<p>void greet() {<br \/>\n    printf(&#034;Hello!\\\\n&#034;);<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    \/\/ \u8c03\u7528\u6709\u8fd4\u56de\u503c\u7684\u51fd\u6570&#xff0c;\u5e76\u5c06\u8fd4\u56de\u503c\u8d4b\u7ed9\u53d8\u91cf<br \/>\n    int result &#061; add(5, 3);<br \/>\n    printf(&#034;5 &#043; 3 &#061; %d\\\\n&#034;, result);<\/p>\n<p>    \/\/ \u76f4\u63a5\u8c03\u7528\u6709\u8fd4\u56de\u503c\u7684\u51fd\u6570&#xff0c;\u5ffd\u7565\u8fd4\u56de\u503c<br \/>\n    add(10, 20);<\/p>\n<p>    \/\/ \u8c03\u7528\u65e0\u8fd4\u56de\u503c\u7684\u51fd\u6570<br \/>\n    greet();<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>5 &#043; 3 &#061; 8<br \/>\nHello!<\/p>\n<h4>6.4.2 \u51fd\u6570\u7684\u5d4c\u5957\u8c03\u7528<\/h4>\n<p>\u51fd\u6570\u7684\u5d4c\u5957\u8c03\u7528\u662f\u6307\u5728\u4e00\u4e2a\u51fd\u6570\u5185\u90e8\u8c03\u7528\u53e6\u4e00\u4e2a\u51fd\u6570\u3002<\/p>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>int add(int a, int b) {<br \/>\n    return a &#043; b;<br \/>\n}<\/p>\n<p>int multiply(int a, int b) {<br \/>\n    return a * b;<br \/>\n}<\/p>\n<p>int calculate(int x, int y) {<br \/>\n    int sum &#061; add(x, y);  \/\/ \u5728calculate\u51fd\u6570\u4e2d\u8c03\u7528add\u51fd\u6570<br \/>\n    int product &#061; multiply(x, y);  \/\/ \u5728calculate\u51fd\u6570\u4e2d\u8c03\u7528multiply\u51fd\u6570<br \/>\n    return sum &#043; product;<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    int x &#061; 5, y &#061; 3;<br \/>\n    int result &#061; calculate(x, y);  \/\/ \u5728main\u51fd\u6570\u4e2d\u8c03\u7528calculate\u51fd\u6570<br \/>\n    printf(&#034;\u8ba1\u7b97\u7ed3\u679c: %d\\\\n&#034;, result);<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>\u8ba1\u7b97\u7ed3\u679c: 23  \/\/ 5&#043;3 &#043; 5*3 &#061; 8 &#043; 15 &#061; 23<\/p>\n<h4>6.4.3 \u51fd\u6570\u7684\u9012\u5f52\u8c03\u7528<\/h4>\n<p>\u9012\u5f52\u8c03\u7528\u662f\u6307\u51fd\u6570\u8c03\u7528\u81ea\u8eab\u7684\u8fc7\u7a0b\u3002\u9012\u5f52\u51fd\u6570\u901a\u5e38\u7528\u4e8e\u89e3\u51b3\u53ef\u4ee5\u5206\u89e3\u4e3a\u76f8\u4f3c\u5b50\u95ee\u9898\u7684\u95ee\u9898&#xff0c;\u5982\u9636\u4e58\u3001\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7b49\u3002<\/p>\n<p>\u9012\u5f52\u51fd\u6570\u7684\u7279\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u6709\u4e00\u4e2a\u6216\u591a\u4e2a\u57fa\u672c\u60c5\u51b5&#xff08;\u7ec8\u6b62\u6761\u4ef6&#xff09;&#xff0c;\u4e0d\u9700\u8981\u9012\u5f52\u5c31\u80fd\u76f4\u63a5\u6c42\u89e3<\/li>\n<li>\u6709\u4e00\u4e2a\u6216\u591a\u4e2a\u9012\u5f52\u60c5\u51b5&#xff0c;\u5c06\u95ee\u9898\u5206\u89e3\u4e3a\u66f4\u5c0f\u7684\u5b50\u95ee\u9898&#xff0c;\u901a\u8fc7\u9012\u5f52\u8c03\u7528\u89e3\u51b3<\/li>\n<\/ul>\n<p>\u793a\u4f8b1&#xff1a;\u8ba1\u7b97n\u7684\u9636\u4e58&#xff08;n!&#xff09;<\/p>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>int factorial(int n) {<br \/>\n    \/\/ \u57fa\u672c\u60c5\u51b5&#xff1a;n&#061;0\u6216n&#061;1\u65f6&#xff0c;\u9636\u4e58\u4e3a1<br \/>\n    if (n &#061;&#061; 0 || n &#061;&#061; 1) {<br \/>\n        return 1;<br \/>\n    }<br \/>\n    \/\/ \u9012\u5f52\u60c5\u51b5&#xff1a;n! &#061; n * (n-1)!<br \/>\n    return n * factorial(n &#8211; 1);<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    int n &#061; 5;<br \/>\n    int result &#061; factorial(n);<br \/>\n    printf(&#034;%d! &#061; %d\\\\n&#034;, n, result);<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>5! &#061; 120<\/p>\n<p>\u793a\u4f8b2&#xff1a;\u8ba1\u7b97\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7684\u7b2cn\u9879<\/p>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>int fibonacci(int n) {<br \/>\n    \/\/ \u57fa\u672c\u60c5\u51b5&#xff1a;\u7b2c1\u9879\u548c\u7b2c2\u9879\u90fd\u662f1<br \/>\n    if (n &#061;&#061; 1 || n &#061;&#061; 2) {<br \/>\n        return 1;<br \/>\n    }<br \/>\n    \/\/ \u9012\u5f52\u60c5\u51b5&#xff1a;\u7b2cn\u9879 &#061; \u7b2cn-1\u9879 &#043; \u7b2cn-2\u9879<br \/>\n    return fibonacci(n &#8211; 1) &#043; fibonacci(n &#8211; 2);<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    int n &#061; 10;<br \/>\n    printf(&#034;\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7b2c%d\u9879: %d\\\\n&#034;, n, fibonacci(n));<\/p>\n<p>    \/\/ \u8f93\u51fa\u524d10\u9879<br \/>\n    printf(&#034;\u524d10\u9879: &#034;);<br \/>\n    for (int i &#061; 1; i &lt;&#061; 10; i&#043;&#043;) {<br \/>\n        printf(&#034;%d &#034;, fibonacci(i));<br \/>\n    }<br \/>\n    printf(&#034;\\\\n&#034;);<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7b2c10\u9879: 55<br \/>\n\u524d10\u9879: 1 1 2 3 5 8 13 21 34 55 <\/p>\n<h4>\u6ce8\u610f\u4e8b\u9879<\/h4>\n<ul>\n<li>\u9012\u5f52\u51fd\u6570\u5fc5\u987b\u6709\u660e\u786e\u7684\u7ec8\u6b62\u6761\u4ef6&#xff0c;\u5426\u5219\u4f1a\u5bfc\u81f4\u65e0\u9650\u9012\u5f52&#xff0c;\u6808\u6ea2\u51fa<\/li>\n<li>\u9012\u5f52\u51fd\u6570\u7684\u6267\u884c\u6548\u7387\u901a\u5e38\u6bd4\u8fed\u4ee3&#xff08;\u5faa\u73af&#xff09;\u4f4e&#xff0c;\u56e0\u4e3a\u6bcf\u6b21\u9012\u5f52\u8c03\u7528\u90fd\u4f1a\u4ea7\u751f\u989d\u5916\u7684\u6808\u5f00\u9500<\/li>\n<li>\u5bf9\u4e8e\u590d\u6742\u95ee\u9898&#xff0c;\u9012\u5f52\u53ef\u4ee5\u4f7f\u4ee3\u7801\u66f4\u7b80\u6d01\u3001\u66f4\u6613\u7406\u89e3<\/li>\n<\/ul>\n<h5>\u7ae0\u8282\u7ec3\u4e60&#xff1a;\u9012\u5f52\u51fd\u6570<\/h5>\n<p>\u7f16\u5199\u4e00\u4e2a\u9012\u5f52\u51fd\u6570&#xff0c;\u8ba1\u7b97\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7684\u7b2cn\u9879&#xff0c;\u7136\u540e\u5728main\u51fd\u6570\u4e2d\u8c03\u7528\u8be5\u51fd\u6570&#xff0c;\u8f93\u51fa\u524d20\u9879\u7684\u6590\u6ce2\u90a3\u5951\u6570\u5217\u3002<\/p>\n<h5>\u7591\u96be\u89e3\u6790&#xff1a;\u9012\u5f52\u51fd\u6570\u4e0e\u8fed\u4ee3\u51fd\u6570\u5982\u4f55\u9009\u62e9&#xff1f;<\/h5>\n<p>\u9012\u5f52\u51fd\u6570\u548c\u8fed\u4ee3\u51fd\u6570\u90fd\u53ef\u4ee5\u7528\u4e8e\u89e3\u51b3\u5faa\u73af\u95ee\u9898&#xff0c;\u4f46\u5b83\u4eec\u5404\u6709\u4f18\u7f3a\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u9012\u5f52\u51fd\u6570&#xff1a;\n<ul>\n<li>\u4f18\u70b9&#xff1a;\u4ee3\u7801\u66f4\u7b80\u6d01\u3001\u66f4\u6613\u7406\u89e3&#xff0c;\u9002\u5408\u89e3\u51b3\u53ef\u4ee5\u5206\u89e3\u4e3a\u76f8\u4f3c\u5b50\u95ee\u9898\u7684\u95ee\u9898<\/li>\n<li>\u7f3a\u70b9&#xff1a;\u6267\u884c\u6548\u7387\u8f83\u4f4e&#xff0c;\u5bb9\u6613\u5bfc\u81f4\u6808\u6ea2\u51fa&#xff0c;\u4e0d\u9002\u5408\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e<\/li>\n<\/ul>\n<\/li>\n<li>\u8fed\u4ee3\u51fd\u6570&#xff1a;\n<ul>\n<li>\u4f18\u70b9&#xff1a;\u6267\u884c\u6548\u7387\u8f83\u9ad8&#xff0c;\u4e0d\u4f1a\u5bfc\u81f4\u6808\u6ea2\u51fa&#xff0c;\u9002\u5408\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e<\/li>\n<li>\u7f3a\u70b9&#xff1a;\u4ee3\u7801\u53ef\u80fd\u66f4\u590d\u6742&#xff0c;\u4e0d\u5982\u9012\u5f52\u51fd\u6570\u76f4\u89c2<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u9009\u62e9\u54ea\u79cd\u65b9\u5f0f\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u95ee\u9898\u548c\u9700\u6c42\u3002\u5bf9\u4e8e\u5c0f\u89c4\u6a21\u6570\u636e\u548c\u590d\u6742\u95ee\u9898&#xff0c;\u9012\u5f52\u51fd\u6570\u53ef\u80fd\u66f4\u5408\u9002&#xff1b;\u5bf9\u4e8e\u5927\u89c4\u6a21\u6570\u636e\u548c\u7b80\u5355\u95ee\u9898&#xff0c;\u8fed\u4ee3\u51fd\u6570\u53ef\u80fd\u66f4\u5408\u9002\u3002<\/p>\n<\/p>\n<h5>\u6613\u9519\u90e8\u5206&#xff1a;\u5fd8\u8bb0\u7ec8\u6b62\u6761\u4ef6<\/h5>\n<p>\u5728\u7f16\u5199\u9012\u5f52\u51fd\u6570\u65f6&#xff0c;\u6700\u5e38\u89c1\u7684\u9519\u8bef\u4e4b\u4e00\u662f\u5fd8\u8bb0\u6dfb\u52a0\u7ec8\u6b62\u6761\u4ef6&#xff0c;\u5bfc\u81f4\u65e0\u9650\u9012\u5f52&#xff0c;\u6700\u7ec8\u6808\u6ea2\u51fa\u3002\u4f8b\u5982&#xff1a;<\/p>\n<p>\/\/ \u9519\u8bef&#xff1a;\u6ca1\u6709\u7ec8\u6b62\u6761\u4ef6<br \/>\nint factorial(int n) {<br \/>\n    return n * factorial(n &#8211; 1);<br \/>\n}<\/p>\n<p>\/\/ \u6b63\u786e&#xff1a;\u6709\u7ec8\u6b62\u6761\u4ef6<br \/>\nint factorial(int n) {<br \/>\n    if (n &#061;&#061; 0 || n &#061;&#061; 1) {<br \/>\n        return 1;<br \/>\n    }<br \/>\n    return n * factorial(n &#8211; 1);<br \/>\n}<\/p>\n<p>\u4e3a\u4e86\u907f\u514d\u8fd9\u79cd\u60c5\u51b5&#xff0c;\u7f16\u5199\u9012\u5f52\u51fd\u6570\u65f6&#xff0c;\u9996\u5148\u5e94\u8be5\u8003\u8651\u7ec8\u6b62\u6761\u4ef6&#xff0c;\u7136\u540e\u518d\u8003\u8651\u9012\u5f52\u903b\u8f91\u3002<\/p>\n<\/p>\n<h5>\u7ae0\u8282\u8da3\u4e8b&#xff1a;\u9012\u5f52\u7684\u5386\u53f2<\/h5>\n<p>\u9012\u5f52\u7684\u6982\u5ff5\u6700\u65e9\u53ef\u4ee5\u8ffd\u6eaf\u5230\u6570\u5b66\u4e2d\u7684\u9012\u5f52\u5b9a\u4e49&#xff0c;\u5982\u9636\u4e58\u3001\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7b49\u3002\u5728\u7f16\u7a0b\u8bed\u8a00\u4e2d&#xff0c;\u9012\u5f52\u7684\u6982\u5ff5\u662f\u7531\u65e9\u671f\u7684\u7f16\u7a0b\u8bed\u8a00\u5982LISP\u5f15\u5165\u7684&#xff0c;LISP\u662f\u4e00\u79cd\u51fd\u6570\u5f0f\u7f16\u7a0b\u8bed\u8a00&#xff0c;\u975e\u5e38\u9002\u5408\u4f7f\u7528\u9012\u5f52\u3002C\u8bed\u8a00\u652f\u6301\u9012\u5f52&#xff0c;\u4f46\u5b83\u662f\u4e00\u79cd\u547d\u4ee4\u5f0f\u7f16\u7a0b\u8bed\u8a00&#xff0c;\u9012\u5f52\u7684\u6267\u884c\u6548\u7387\u76f8\u5bf9\u8f83\u4f4e\u3002\u73b0\u4ee3\u7f16\u7a0b\u8bed\u8a00\u5982Python\u3001Java\u3001C&#043;&#043;\u7b49\u90fd\u652f\u6301\u9012\u5f52&#xff0c;\u5e76\u5bf9\u5176\u8fdb\u884c\u4e86\u4f18\u5316\u3002<\/p>\n<h3>6.5 \u53d8\u91cf\u7684\u4f5c\u7528\u57df\u548c\u5b58\u50a8\u7c7b\u522b<\/h3>\n<h4>6.5.1 \u53d8\u91cf\u7684\u4f5c\u7528\u57df<\/h4>\n<p>\u53d8\u91cf\u7684\u4f5c\u7528\u57df\u662f\u6307\u53d8\u91cf\u5728\u7a0b\u5e8f\u4e2d\u53ef\u4ee5\u88ab\u8bbf\u95ee\u7684\u8303\u56f4\u3002C\u8bed\u8a00\u4e2d\u7684\u53d8\u91cf\u4f5c\u7528\u57df\u5206\u4e3a\u4ee5\u4e0b\u51e0\u79cd&#xff1a;<\/p>\n<h5>1. \u5c40\u90e8\u53d8\u91cf<\/h5>\n<p>\u5c40\u90e8\u53d8\u91cf\u662f\u5728\u51fd\u6570\u5185\u90e8\u6216\u4ee3\u7801\u5757\u5185\u90e8\u5b9a\u4e49\u7684\u53d8\u91cf&#xff0c;\u5b83\u7684\u4f5c\u7528\u57df\u4ec5\u9650\u4e8e\u5b9a\u4e49\u5b83\u7684\u51fd\u6570\u6216\u4ee3\u7801\u5757\u5185\u90e8\u3002<\/p>\n<p>\u7279\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u5c40\u90e8\u53d8\u91cf\u5728\u51fd\u6570\u8c03\u7528\u65f6\u88ab\u521b\u5efa&#xff0c;\u51fd\u6570\u8fd4\u56de\u65f6\u88ab\u9500\u6bc1<\/li>\n<li>\u5c40\u90e8\u53d8\u91cf\u5728\u4e0d\u540c\u7684\u51fd\u6570\u4e2d\u53ef\u4ee5\u91cd\u540d&#xff0c;\u5b83\u4eec\u662f\u4e0d\u540c\u7684\u53d8\u91cf<\/li>\n<li>\u5c40\u90e8\u53d8\u91cf\u5982\u679c\u6ca1\u6709\u521d\u59cb\u5316&#xff0c;\u5176\u503c\u662f\u4e0d\u786e\u5b9a\u7684<\/li>\n<\/ul>\n<h5>2. \u5168\u5c40\u53d8\u91cf<\/h5>\n<p>\u5168\u5c40\u53d8\u91cf\u662f\u5728\u51fd\u6570\u5916\u90e8\u5b9a\u4e49\u7684\u53d8\u91cf&#xff0c;\u5b83\u7684\u4f5c\u7528\u57df\u662f\u6574\u4e2a\u7a0b\u5e8f\u3002<\/p>\n<p>\u7279\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u5168\u5c40\u53d8\u91cf\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u88ab\u521b\u5efa&#xff0c;\u7a0b\u5e8f\u7ed3\u675f\u65f6\u88ab\u9500\u6bc1<\/li>\n<li>\u5168\u5c40\u53d8\u91cf\u5728\u6240\u6709\u51fd\u6570\u4e2d\u90fd\u53ef\u4ee5\u8bbf\u95ee\u548c\u4fee\u6539<\/li>\n<li>\u5168\u5c40\u53d8\u91cf\u5982\u679c\u6ca1\u6709\u521d\u59cb\u5316&#xff0c;\u4f1a\u88ab\u81ea\u52a8\u521d\u59cb\u5316\u4e3a0<\/li>\n<\/ul>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>int global_var &#061; 10;  \/\/ \u5168\u5c40\u53d8\u91cf<\/p>\n<p>void func1() {<br \/>\n    int local_var &#061; 5;  \/\/ \u5c40\u90e8\u53d8\u91cf<br \/>\n    printf(&#034;func1: global_var &#061; %d, local_var &#061; %d\\\\n&#034;, global_var, local_var);<br \/>\n}<\/p>\n<p>void func2() {<br \/>\n    int local_var &#061; 8;  \/\/ \u4e0efunc1\u4e2d\u7684local_var\u91cd\u540d&#xff0c;\u662f\u4e0d\u540c\u7684\u53d8\u91cf<br \/>\n    printf(&#034;func2: global_var &#061; %d, local_var &#061; %d\\\\n&#034;, global_var, local_var);<\/p>\n<p>    \/\/ \u4fee\u6539\u5168\u5c40\u53d8\u91cf<br \/>\n    global_var &#061; 20;<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    printf(&#034;main: global_var &#061; %d\\\\n&#034;, global_var);<br \/>\n    func1();<br \/>\n    func2();<br \/>\n    printf(&#034;main: global_var &#061; %d\\\\n&#034;, global_var);  \/\/ \u5168\u5c40\u53d8\u91cf\u5df2\u88ab\u4fee\u6539<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>main: global_var &#061; 10<br \/>\nfunc1: global_var &#061; 10, local_var &#061; 5<br \/>\nfunc2: global_var &#061; 10, local_var &#061; 8<br \/>\nmain: global_var &#061; 20<\/p>\n<h4>6.5.2 \u53d8\u91cf\u7684\u5b58\u50a8\u7c7b\u522b<\/h4>\n<p>\u53d8\u91cf\u7684\u5b58\u50a8\u7c7b\u522b\u51b3\u5b9a\u4e86\u53d8\u91cf\u7684\u5b58\u50a8\u4f4d\u7f6e\u3001\u751f\u547d\u5468\u671f\u548c\u53ef\u89c1\u6027\u3002C\u8bed\u8a00\u4e2d\u7684\u53d8\u91cf\u5b58\u50a8\u7c7b\u522b\u6709\u4ee5\u4e0b\u51e0\u79cd&#xff1a;<\/p>\n<h5>1. auto\u5b58\u50a8\u7c7b\u522b<\/h5>\n<p>auto\u5b58\u50a8\u7c7b\u522b\u662f\u5c40\u90e8\u53d8\u91cf\u7684\u9ed8\u8ba4\u5b58\u50a8\u7c7b\u522b&#xff0c;\u5b83\u8868\u793a\u53d8\u91cf\u5b58\u50a8\u5728\u6808\u5185\u5b58\u4e2d\u3002<\/p>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>void func() {<br \/>\n    auto int x &#061; 5;  \/\/ \u7b49\u540c\u4e8e int x &#061; 5;<br \/>\n}<\/p>\n<h5>2. static\u5b58\u50a8\u7c7b\u522b<\/h5>\n<p>static\u5b58\u50a8\u7c7b\u522b\u53ef\u4ee5\u7528\u4e8e\u5c40\u90e8\u53d8\u91cf\u548c\u5168\u5c40\u53d8\u91cf&#xff1a;<\/p>\n<ul>\n<li>\u5bf9\u4e8e\u5c40\u90e8\u53d8\u91cf&#xff1a;static\u5c40\u90e8\u53d8\u91cf\u5b58\u50a8\u5728\u9759\u6001\u5185\u5b58\u4e2d&#xff0c;\u5b83\u7684\u751f\u547d\u5468\u671f\u662f\u6574\u4e2a\u7a0b\u5e8f&#xff0c;\u800c\u4f5c\u7528\u57df\u4ecd\u7136\u662f\u5b9a\u4e49\u5b83\u7684\u51fd\u6570\u6216\u4ee3\u7801\u5757\u5185\u90e8\u3002static\u5c40\u90e8\u53d8\u91cf\u53ea\u521d\u59cb\u5316\u4e00\u6b21&#xff0c;\u6bcf\u6b21\u51fd\u6570\u8c03\u7528\u65f6\u4fdd\u7559\u4e0a\u6b21\u7684\u503c\u3002<\/li>\n<li>\u5bf9\u4e8e\u5168\u5c40\u53d8\u91cf&#xff1a;static\u5168\u5c40\u53d8\u91cf\u7684\u4f5c\u7528\u57df\u4ec5\u9650\u4e8e\u5b9a\u4e49\u5b83\u7684\u6e90\u6587\u4ef6&#xff0c;\u5176\u4ed6\u6e90\u6587\u4ef6\u65e0\u6cd5\u8bbf\u95ee\u3002<\/li>\n<\/ul>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>void func() {<br \/>\n    int auto_var &#061; 0;  \/\/ auto\u5c40\u90e8\u53d8\u91cf&#xff0c;\u6bcf\u6b21\u8c03\u7528\u91cd\u65b0\u521d\u59cb\u5316<br \/>\n    static int static_var &#061; 0;  \/\/ static\u5c40\u90e8\u53d8\u91cf&#xff0c;\u53ea\u521d\u59cb\u5316\u4e00\u6b21<\/p>\n<p>    auto_var&#043;&#043;;<br \/>\n    static_var&#043;&#043;;<\/p>\n<p>    printf(&#034;auto_var &#061; %d, static_var &#061; %d\\\\n&#034;, auto_var, static_var);<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    printf(&#034;\u7b2c\u4e00\u6b21\u8c03\u7528func()&#xff1a;&#034;);<br \/>\n    func();<\/p>\n<p>    printf(&#034;\u7b2c\u4e8c\u6b21\u8c03\u7528func()&#xff1a;&#034;);<br \/>\n    func();<\/p>\n<p>    printf(&#034;\u7b2c\u4e09\u6b21\u8c03\u7528func()&#xff1a;&#034;);<br \/>\n    func();<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>\u7b2c\u4e00\u6b21\u8c03\u7528func()&#xff1a;auto_var &#061; 1, static_var &#061; 1<br \/>\n\u7b2c\u4e8c\u6b21\u8c03\u7528func()&#xff1a;auto_var &#061; 1, static_var &#061; 2<br \/>\n\u7b2c\u4e09\u6b21\u8c03\u7528func()&#xff1a;auto_var &#061; 1, static_var &#061; 3<\/p>\n<h5>3. extern\u5b58\u50a8\u7c7b\u522b<\/h5>\n<p>extern\u5b58\u50a8\u7c7b\u522b\u7528\u4e8e\u58f0\u660e\u5916\u90e8\u53d8\u91cf&#xff0c;\u5373\u58f0\u660e\u5728\u5176\u4ed6\u6e90\u6587\u4ef6\u4e2d\u5b9a\u4e49\u7684\u5168\u5c40\u53d8\u91cf\u3002<\/p>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>\/\/ file1.c<br \/>\nextern int global_var;  \/\/ \u58f0\u660e\u5728\u5176\u4ed6\u6587\u4ef6\u4e2d\u5b9a\u4e49\u7684\u5168\u5c40\u53d8\u91cf<\/p>\n<p>void func() {<br \/>\n    printf(&#034;global_var &#061; %d\\\\n&#034;, global_var);<br \/>\n}<\/p>\n<p>\/\/ file2.c<br \/>\nint global_var &#061; 10;  \/\/ \u5b9a\u4e49\u5168\u5c40\u53d8\u91cf<\/p>\n<h5>4. register\u5b58\u50a8\u7c7b\u522b<\/h5>\n<p>register\u5b58\u50a8\u7c7b\u522b\u7528\u4e8e\u58f0\u660e\u5bc4\u5b58\u5668\u53d8\u91cf&#xff0c;\u5b83\u5efa\u8bae\u7f16\u8bd1\u5668\u5c06\u53d8\u91cf\u5b58\u50a8\u5728CPU\u5bc4\u5b58\u5668\u4e2d&#xff0c;\u4ee5\u63d0\u9ad8\u8bbf\u95ee\u901f\u5ea6\u3002<\/p>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>void func() {<br \/>\n    register int count &#061; 0;  \/\/ \u5efa\u8bae\u5c06count\u5b58\u50a8\u5728\u5bc4\u5b58\u5668\u4e2d<br \/>\n    \/\/ &#8230;<br \/>\n}<\/p>\n<h4>\u6ce8\u610f\u4e8b\u9879<\/h4>\n<ul>\n<li>\u7531\u4e8e\u5bc4\u5b58\u5668\u6570\u91cf\u6709\u9650&#xff0c;register\u5173\u952e\u5b57\u53ea\u662f\u4e00\u4e2a\u5efa\u8bae&#xff0c;\u7f16\u8bd1\u5668\u53ef\u80fd\u4f1a\u5ffd\u7565<\/li>\n<li>\u73b0\u4ee3\u7f16\u8bd1\u5668\u7684\u4f18\u5316\u80fd\u529b\u5f88\u5f3a&#xff0c;\u901a\u5e38\u4f1a\u81ea\u52a8\u5c06\u9891\u7e41\u4f7f\u7528\u7684\u53d8\u91cf\u5b58\u50a8\u5728\u5bc4\u5b58\u5668\u4e2d<\/li>\n<\/ul>\n<h3>6.6 \u51fd\u6570\u8bbe\u8ba1\u6a21\u5f0f<\/h3>\n<h4>6.6.1 \u51fd\u6570\u8bbe\u8ba1\u539f\u5219<\/h4>\n<p>\u826f\u597d\u7684\u51fd\u6570\u8bbe\u8ba1\u6709\u52a9\u4e8e\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3001\u53ef\u7ef4\u62a4\u6027\u548c\u53ef\u590d\u7528\u6027\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u51fd\u6570\u8bbe\u8ba1\u539f\u5219&#xff1a;<\/p>\n<ul>\n<li>\u5355\u4e00\u804c\u8d23\u539f\u5219&#xff1a;\u4e00\u4e2a\u51fd\u6570\u5e94\u8be5\u53ea\u5b8c\u6210\u4e00\u4e2a\u7279\u5b9a\u7684\u529f\u80fd&#xff0c;\u907f\u514d\u51fd\u6570\u8fc7\u4e8e\u590d\u6742<\/li>\n<li>\u51fd\u6570\u540d\u5e94\u8be5\u6e05\u6670\u8868\u8fbe\u5176\u529f\u80fd&#xff1a;\u51fd\u6570\u540d\u5e94\u8be5\u80fd\u591f\u76f4\u89c2\u5730\u53cd\u6620\u51fd\u6570\u7684\u7528\u9014<\/li>\n<li>\u51fd\u6570\u53c2\u6570\u5e94\u8be5\u5c3d\u91cf\u5c11&#xff1a;\u8fc7\u591a\u7684\u53c2\u6570\u4f1a\u589e\u52a0\u51fd\u6570\u8c03\u7528\u7684\u590d\u6742\u5ea6&#xff0c;\u5efa\u8bae\u4e0d\u8d85\u8fc75\u4e2a<\/li>\n<li>\u51fd\u6570\u5e94\u8be5\u6709\u660e\u786e\u7684\u8fd4\u56de\u503c&#xff1a;\u8fd4\u56de\u503c\u5e94\u8be5\u80fd\u591f\u6e05\u6670\u5730\u8868\u8fbe\u51fd\u6570\u6267\u884c\u7684\u7ed3\u679c<\/li>\n<li>\u907f\u514d\u526f\u4f5c\u7528&#xff1a;\u51fd\u6570\u5e94\u8be5\u5c3d\u91cf\u907f\u514d\u4fee\u6539\u5168\u5c40\u53d8\u91cf\u6216\u5916\u90e8\u72b6\u6001<\/li>\n<li>\u51fd\u6570\u5e94\u8be5\u6709\u9002\u5f53\u7684\u6ce8\u91ca&#xff1a;\u6ce8\u91ca\u5e94\u8be5\u89e3\u91ca\u51fd\u6570\u7684\u529f\u80fd\u3001\u53c2\u6570\u3001\u8fd4\u56de\u503c\u548c\u4f7f\u7528\u65b9\u6cd5<\/li>\n<\/ul>\n<h4>6.6.2 \u5e38\u89c1\u51fd\u6570\u8bbe\u8ba1\u6a21\u5f0f<\/h4>\n<h5>1. \u5305\u88c5\u5668\u6a21\u5f0f<\/h5>\n<p>\u5305\u88c5\u5668\u6a21\u5f0f&#xff08;Wrapper Pattern&#xff09;\u662f\u6307\u521b\u5efa\u4e00\u4e2a\u51fd\u6570\u6765\u5305\u88c5\u53e6\u4e00\u4e2a\u51fd\u6570&#xff0c;\u4e3a\u5176\u6dfb\u52a0\u989d\u5916\u7684\u529f\u80fd&#xff0c;\u5982\u65e5\u5fd7\u8bb0\u5f55\u3001\u9519\u8bef\u5904\u7406\u3001\u6027\u80fd\u76d1\u63a7\u7b49\u3002<\/p>\n<h6>\u793a\u4f8b&#xff1a;\u65e5\u5fd7\u5305\u88c5\u5668<\/h6>\n<p>#include &lt;stdio.h&gt;<br \/>\n#include &lt;time.h&gt;<\/p>\n<p>\/\/ \u539f\u59cb\u51fd\u6570<br \/>\nint add(int a, int b) {<br \/>\n    return a &#043; b;<br \/>\n}<\/p>\n<p>\/\/ \u5305\u88c5\u5668\u51fd\u6570&#xff0c;\u6dfb\u52a0\u65e5\u5fd7\u529f\u80fd<br \/>\nint add_with_log(int a, int b) {<br \/>\n    \/\/ \u8bb0\u5f55\u5f00\u59cb\u65f6\u95f4<br \/>\n    time_t start_time &#061; time(NULL);<\/p>\n<p>    \/\/ \u8c03\u7528\u539f\u59cb\u51fd\u6570<br \/>\n    int result &#061; add(a, b);<\/p>\n<p>    \/\/ \u8bb0\u5f55\u7ed3\u675f\u65f6\u95f4\u548c\u7ed3\u679c<br \/>\n    time_t end_time &#061; time(NULL);<br \/>\n    printf(&#034;[LOG] add(%d, %d) &#061; %d, \u8017\u65f6&#xff1a;%ld\u79d2\\\\n&#034;, a, b, result, end_time &#8211; start_time);<\/p>\n<p>    return result;<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    int result &#061; add_with_log(5, 3);<br \/>\n    printf(&#034;\u6700\u7ec8\u7ed3\u679c&#xff1a;%d\\\\n&#034;, result);<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>[LOG] add(5, 3) &#061; 8, \u8017\u65f6&#xff1a;0\u79d2<br \/>\n\u6700\u7ec8\u7ed3\u679c&#xff1a;8<\/p>\n<h5>2. \u7b56\u7565\u6a21\u5f0f<\/h5>\n<p>\u7b56\u7565\u6a21\u5f0f&#xff08;Strategy Pattern&#xff09;\u662f\u6307\u5b9a\u4e49\u4e00\u7cfb\u5217\u7b97\u6cd5&#xff0c;\u5c06\u5b83\u4eec\u5c01\u88c5\u8d77\u6765&#xff0c;\u5e76\u4f7f\u5b83\u4eec\u53ef\u4ee5\u76f8\u4e92\u66ff\u6362\u3002\u5728C\u8bed\u8a00\u4e2d&#xff0c;\u7b56\u7565\u6a21\u5f0f\u901a\u5e38\u901a\u8fc7\u51fd\u6570\u6307\u9488\u5b9e\u73b0\u3002<\/p>\n<h6>\u793a\u4f8b&#xff1a;\u8ba1\u7b97\u5668\u7b56\u7565\u6a21\u5f0f<\/h6>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>\/\/ \u7b56\u7565\u51fd\u6570\u7c7b\u578b\u5b9a\u4e49<br \/>\ntypedef int (*CalculationStrategy)(int, int);<\/p>\n<p>\/\/ \u5177\u4f53\u7b56\u7565&#xff1a;\u52a0\u6cd5<br \/>\nint add(int a, int b) {<br \/>\n    return a &#043; b;<br \/>\n}<\/p>\n<p>\/\/ \u5177\u4f53\u7b56\u7565&#xff1a;\u51cf\u6cd5<br \/>\nint subtract(int a, int b) {<br \/>\n    return a &#8211; b;<br \/>\n}<\/p>\n<p>\/\/ \u5177\u4f53\u7b56\u7565&#xff1a;\u4e58\u6cd5<br \/>\nint multiply(int a, int b) {<br \/>\n    return a * b;<br \/>\n}<\/p>\n<p>\/\/ \u5177\u4f53\u7b56\u7565&#xff1a;\u9664\u6cd5<br \/>\nint divide(int a, int b) {<br \/>\n    if (b &#061;&#061; 0) {<br \/>\n        printf(&#034;\u9519\u8bef&#xff1a;\u9664\u6570\u4e0d\u80fd\u4e3a0\\\\n&#034;);<br \/>\n        return 0;<br \/>\n    }<br \/>\n    return a \/ b;<br \/>\n}<\/p>\n<p>\/\/ \u4e0a\u4e0b\u6587\u51fd\u6570&#xff0c;\u4f7f\u7528\u7b56\u7565<br \/>\nint calculate(int a, int b, CalculationStrategy strategy) {<br \/>\n    return strategy(a, b);<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    int a &#061; 10, b &#061; 5;<\/p>\n<p>    printf(&#034;%d &#043; %d &#061; %d\\\\n&#034;, a, b, calculate(a, b, add));<br \/>\n    printf(&#034;%d &#8211; %d &#061; %d\\\\n&#034;, a, b, calculate(a, b, subtract));<br \/>\n    printf(&#034;%d * %d &#061; %d\\\\n&#034;, a, b, calculate(a, b, multiply));<br \/>\n    printf(&#034;%d \/ %d &#061; %d\\\\n&#034;, a, b, calculate(a, b, divide));<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>10 &#043; 5 &#061; 15<br \/>\n10 &#8211; 5 &#061; 5<br \/>\n10 * 5 &#061; 50<br \/>\n10 \/ 5 &#061; 2<\/p>\n<h5>3. \u5de5\u5382\u6a21\u5f0f<\/h5>\n<p>\u5de5\u5382\u6a21\u5f0f&#xff08;Factory Pattern&#xff09;\u662f\u6307\u521b\u5efa\u4e00\u4e2a\u51fd\u6570\u6765\u6839\u636e\u4e0d\u540c\u7684\u6761\u4ef6\u521b\u5efa\u5e76\u8fd4\u56de\u4e0d\u540c\u7684\u51fd\u6570\u6307\u9488&#xff0c;\u5b9e\u73b0\u52a8\u6001\u51fd\u6570\u9009\u62e9\u3002<\/p>\n<h6>\u793a\u4f8b&#xff1a;\u6392\u5e8f\u7b97\u6cd5\u5de5\u5382<\/h6>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>\/\/ \u6392\u5e8f\u51fd\u6570\u7c7b\u578b\u5b9a\u4e49<br \/>\ntypedef void (*SortAlgorithm)(int[], int);<\/p>\n<p>\/\/ \u5192\u6ce1\u6392\u5e8f<br \/>\nvoid bubble_sort(int arr[], int n) {<br \/>\n    for (int i &#061; 0; i &lt; n &#8211; 1; i&#043;&#043;) {<br \/>\n        for (int j &#061; 0; j &lt; n &#8211; 1 &#8211; i; j&#043;&#043;) {<br \/>\n            if (arr[j] &gt; arr[j &#043; 1]) {<br \/>\n                int temp &#061; arr[j];<br \/>\n                arr[j] &#061; arr[j &#043; 1];<br \/>\n                arr[j &#043; 1] &#061; temp;<br \/>\n            }<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ \u9009\u62e9\u6392\u5e8f<br \/>\nvoid selection_sort(int arr[], int n) {<br \/>\n    for (int i &#061; 0; i &lt; n &#8211; 1; i&#043;&#043;) {<br \/>\n        int min_idx &#061; i;<br \/>\n        for (int j &#061; i &#043; 1; j &lt; n; j&#043;&#043;) {<br \/>\n            if (arr[j] &lt; arr[min_idx]) {<br \/>\n                min_idx &#061; j;<br \/>\n            }<br \/>\n        }<br \/>\n        int temp &#061; arr[i];<br \/>\n        arr[i] &#061; arr[min_idx];<br \/>\n        arr[min_idx] &#061; temp;<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ \u63d2\u5165\u6392\u5e8f<br \/>\nvoid insertion_sort(int arr[], int n) {<br \/>\n    for (int i &#061; 1; i &lt; n; i&#043;&#043;) {<br \/>\n        int key &#061; arr[i];<br \/>\n        int j &#061; i &#8211; 1;<br \/>\n        while (j &gt;&#061; 0 &amp;&amp; arr[j] &gt; key) {<br \/>\n            arr[j &#043; 1] &#061; arr[j];<br \/>\n            j&#8211;;<br \/>\n        }<br \/>\n        arr[j &#043; 1] &#061; key;<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ \u6392\u5e8f\u7b97\u6cd5\u5de5\u5382\u51fd\u6570<br \/>\nSortAlgorithm get_sort_algorithm(const char* name) {<br \/>\n    if (strcmp(name, &#034;bubble&#034;) &#061;&#061; 0) {<br \/>\n        return bubble_sort;<br \/>\n    } else if (strcmp(name, &#034;selection&#034;) &#061;&#061; 0) {<br \/>\n        return selection_sort;<br \/>\n    } else if (strcmp(name, &#034;insertion&#034;) &#061;&#061; 0) {<br \/>\n        return insertion_sort;<br \/>\n    } else {<br \/>\n        printf(&#034;\u672a\u77e5\u7684\u6392\u5e8f\u7b97\u6cd5&#xff1a;%s\\\\n&#034;, name);<br \/>\n        return NULL;<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ \u6253\u5370\u6570\u7ec4<br \/>\nvoid print_array(int arr[], int n) {<br \/>\n    for (int i &#061; 0; i &lt; n; i&#043;&#043;) {<br \/>\n        printf(&#034;%d &#034;, arr[i]);<br \/>\n    }<br \/>\n    printf(&#034;\\\\n&#034;);<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    int arr[] &#061; {5, 2, 8, 1, 9, 3};<br \/>\n    int n &#061; sizeof(arr) \/ sizeof(arr[0]);<\/p>\n<p>    printf(&#034;\u539f\u59cb\u6570\u7ec4&#xff1a;&#034;);<br \/>\n    print_array(arr, n);<\/p>\n<p>    \/\/ \u4f7f\u7528\u5192\u6ce1\u6392\u5e8f<br \/>\n    SortAlgorithm sort_func &#061; get_sort_algorithm(&#034;bubble&#034;);<br \/>\n    if (sort_func !&#061; NULL) {<br \/>\n        sort_func(arr, n);<br \/>\n        printf(&#034;\u5192\u6ce1\u6392\u5e8f\u540e&#xff1a;&#034;);<br \/>\n        print_array(arr, n);<br \/>\n    }<\/p>\n<p>    \/\/ \u91cd\u7f6e\u6570\u7ec4<br \/>\n    int arr2[] &#061; {5, 2, 8, 1, 9, 3};<\/p>\n<p>    \/\/ \u4f7f\u7528\u63d2\u5165\u6392\u5e8f<br \/>\n    sort_func &#061; get_sort_algorithm(&#034;insertion&#034;);<br \/>\n    if (sort_func !&#061; NULL) {<br \/>\n        sort_func(arr2, n);<br \/>\n        printf(&#034;\u63d2\u5165\u6392\u5e8f\u540e&#xff1a;&#034;);<br \/>\n        print_array(arr2, n);<br \/>\n    }<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>\u539f\u59cb\u6570\u7ec4&#xff1a;5 2 8 1 9 3<br \/>\n\u5192\u6ce1\u6392\u5e8f\u540e&#xff1a;1 2 3 5 8 9<br \/>\n\u63d2\u5165\u6392\u5e8f\u540e&#xff1a;1 2 3 5 8 9 <\/p>\n<h3>6.7 \u9012\u5f52\u6df1\u5ea6\u89e3\u6790<\/h3>\n<h4>6.7.1 \u9012\u5f52\u7684\u57fa\u672c\u6982\u5ff5<\/h4>\n<p>\u9012\u5f52&#xff08;Recursion&#xff09;\u662f\u6307\u51fd\u6570\u8c03\u7528\u81ea\u8eab\u7684\u8fc7\u7a0b\u3002\u9012\u5f52\u51fd\u6570\u5fc5\u987b\u5177\u5907\u4e24\u4e2a\u6761\u4ef6&#xff1a;<\/p>\n<ul>\n<li>\u57fa\u672c\u60c5\u51b5&#xff08;Base Case&#xff09;&#xff1a;\u9012\u5f52\u7ec8\u6b62\u7684\u6761\u4ef6&#xff0c;\u4e0d\u9700\u8981\u8fdb\u4e00\u6b65\u9012\u5f52\u5c31\u80fd\u76f4\u63a5\u6c42\u89e3<\/li>\n<li>\u9012\u5f52\u60c5\u51b5&#xff08;Recursive Case&#xff09;&#xff1a;\u5c06\u95ee\u9898\u5206\u89e3\u4e3a\u66f4\u5c0f\u7684\u5b50\u95ee\u9898&#xff0c;\u901a\u8fc7\u9012\u5f52\u8c03\u7528\u89e3\u51b3<\/li>\n<\/ul>\n<h4>6.7.2 \u9012\u5f52\u7684\u5de5\u4f5c\u539f\u7406<\/h4>\n<p>\u9012\u5f52\u51fd\u6570\u7684\u6267\u884c\u8fc7\u7a0b\u53ef\u4ee5\u5206\u4e3a\u4e24\u4e2a\u9636\u6bb5&#xff1a;<\/p>\n<ul>\n<li>\u9012\u63a8\u9636\u6bb5&#xff1a;\u51fd\u6570\u4e0d\u65ad\u8c03\u7528\u81ea\u8eab&#xff0c;\u5c06\u95ee\u9898\u5206\u89e3\u4e3a\u66f4\u5c0f\u7684\u5b50\u95ee\u9898&#xff0c;\u76f4\u5230\u8fbe\u5230\u57fa\u672c\u60c5\u51b5<\/li>\n<li>\u56de\u5f52\u9636\u6bb5&#xff1a;\u4ece\u57fa\u672c\u60c5\u51b5\u5f00\u59cb&#xff0c;\u9010\u6b65\u8fd4\u56de\u7ed3\u679c&#xff0c;\u76f4\u5230\u5f97\u5230\u539f\u95ee\u9898\u7684\u89e3<\/li>\n<\/ul>\n<h6>\u9012\u5f52\u8c03\u7528\u6808<\/h6>\n<p>\u6bcf\u6b21\u9012\u5f52\u8c03\u7528\u90fd\u4f1a\u5728\u5185\u5b58\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6808\u5e27&#xff0c;\u7528\u4e8e\u5b58\u50a8\u51fd\u6570\u7684\u5c40\u90e8\u53d8\u91cf\u3001\u53c2\u6570\u548c\u8fd4\u56de\u5730\u5740\u3002\u5f53\u9012\u5f52\u6df1\u5ea6\u8fc7\u5927\u65f6&#xff0c;\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6808\u6ea2\u51fa&#xff08;Stack Overflow&#xff09;\u3002<\/p>\n<h4>6.7.3 \u9012\u5f52\u7b97\u6cd5\u7684\u4f18\u5316<\/h4>\n<h5>1. \u5c3e\u9012\u5f52\u4f18\u5316<\/h5>\n<p>\u5c3e\u9012\u5f52&#xff08;Tail Recursion&#xff09;\u662f\u6307\u9012\u5f52\u8c03\u7528\u662f\u51fd\u6570\u7684\u6700\u540e\u4e00\u4e2a\u64cd\u4f5c&#xff0c;\u8fd9\u6837\u7f16\u8bd1\u5668\u53ef\u4ee5\u4f18\u5316\u9012\u5f52\u8c03\u7528&#xff0c;\u907f\u514d\u521b\u5efa\u65b0\u7684\u6808\u5e27\u3002<\/p>\n<h6>\u793a\u4f8b&#xff1a;\u5c3e\u9012\u5f52\u9636\u4e58<\/h6>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>\/\/ \u666e\u901a\u9012\u5f52\u9636\u4e58<br \/>\nint factorial(int n) {<br \/>\n    if (n &#061;&#061; 0 || n &#061;&#061; 1) {<br \/>\n        return 1;<br \/>\n    }<br \/>\n    return n * factorial(n &#8211; 1);  \/\/ \u9012\u5f52\u8c03\u7528\u4e0d\u662f\u6700\u540e\u4e00\u4e2a\u64cd\u4f5c<br \/>\n}<\/p>\n<p>\/\/ \u5c3e\u9012\u5f52\u9636\u4e58<br \/>\nint factorial_tail(int n, int accumulator) {<br \/>\n    if (n &#061;&#061; 0 || n &#061;&#061; 1) {<br \/>\n        return accumulator;<br \/>\n    }<br \/>\n    return factorial_tail(n &#8211; 1, n * accumulator);  \/\/ \u9012\u5f52\u8c03\u7528\u662f\u6700\u540e\u4e00\u4e2a\u64cd\u4f5c<br \/>\n}<\/p>\n<p>\/\/ \u5305\u88c5\u51fd\u6570&#xff0c;\u63d0\u4f9b\u66f4\u53cb\u597d\u7684\u63a5\u53e3<br \/>\nint factorial_wrapper(int n) {<br \/>\n    return factorial_tail(n, 1);<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    int n &#061; 5;<br \/>\n    printf(&#034;\u666e\u901a\u9012\u5f52&#xff1a;%d! &#061; %d\\\\n&#034;, n, factorial(n));<br \/>\n    printf(&#034;\u5c3e\u9012\u5f52&#xff1a;%d! &#061; %d\\\\n&#034;, n, factorial_wrapper(n));<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>\u666e\u901a\u9012\u5f52&#xff1a;5! &#061; 120<br \/>\n\u5c3e\u9012\u5f52&#xff1a;5! &#061; 120<\/p>\n<h5>2. \u8bb0\u5fc6\u5316\u4f18\u5316<\/h5>\n<p>\u8bb0\u5fc6\u5316&#xff08;Memoization&#xff09;\u662f\u6307\u5c06\u5df2\u7ecf\u8ba1\u7b97\u8fc7\u7684\u7ed3\u679c\u5b58\u50a8\u8d77\u6765&#xff0c;\u907f\u514d\u91cd\u590d\u8ba1\u7b97&#xff0c;\u63d0\u9ad8\u9012\u5f52\u6548\u7387\u3002<\/p>\n<h6>\u793a\u4f8b&#xff1a;\u8bb0\u5fc6\u5316\u6590\u6ce2\u90a3\u5951\u6570\u5217<\/h6>\n<p>#include &lt;stdio.h&gt;<br \/>\n#include &lt;stdlib.h&gt;<\/p>\n<p>\/\/ \u8bb0\u5fc6\u5316\u6570\u7ec4&#xff0c;\u7528\u4e8e\u5b58\u50a8\u5df2\u7ecf\u8ba1\u7b97\u8fc7\u7684\u7ed3\u679c<br \/>\nlong long* memo;<\/p>\n<p>\/\/ \u8bb0\u5fc6\u5316\u6590\u6ce2\u90a3\u5951\u6570\u5217<br \/>\nlong long fibonacci_memo(int n) {<br \/>\n    \/\/ \u57fa\u672c\u60c5\u51b5<br \/>\n    if (n &#061;&#061; 0) {<br \/>\n        return 0;<br \/>\n    }<br \/>\n    if (n &#061;&#061; 1 || n &#061;&#061; 2) {<br \/>\n        return 1;<br \/>\n    }<\/p>\n<p>    \/\/ \u5982\u679c\u5df2\u7ecf\u8ba1\u7b97\u8fc7&#xff0c;\u76f4\u63a5\u8fd4\u56de\u7ed3\u679c<br \/>\n    if (memo[n] !&#061; -1) {<br \/>\n        return memo[n];<br \/>\n    }<\/p>\n<p>    \/\/ \u8ba1\u7b97\u5e76\u5b58\u50a8\u7ed3\u679c<br \/>\n    memo[n] &#061; fibonacci_memo(n &#8211; 1) &#043; fibonacci_memo(n &#8211; 2);<br \/>\n    return memo[n];<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    int n &#061; 50;<\/p>\n<p>    \/\/ \u521d\u59cb\u5316\u8bb0\u5fc6\u5316\u6570\u7ec4<br \/>\n    memo &#061; (long long*)malloc((n &#043; 1) * sizeof(long long));<br \/>\n    for (int i &#061; 0; i &lt;&#061; n; i&#043;&#043;) {<br \/>\n        memo[i] &#061; -1;<br \/>\n    }<\/p>\n<p>    printf(&#034;\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7b2c%d\u9879: %lld\\\\n&#034;, n, fibonacci_memo(n));<\/p>\n<p>    \/\/ \u91ca\u653e\u5185\u5b58<br \/>\n    free(memo);<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7b2c50\u9879: 12586269025<\/p>\n<h4>6.7.4 \u9012\u5f52\u4e0e\u8fed\u4ee3\u7684\u8f6c\u6362<\/h4>\n<p>\u4efb\u4f55\u9012\u5f52\u7b97\u6cd5\u90fd\u53ef\u4ee5\u8f6c\u6362\u4e3a\u8fed\u4ee3\u7b97\u6cd5&#xff0c;\u8fed\u4ee3\u7b97\u6cd5\u901a\u5e38\u5177\u6709\u66f4\u9ad8\u7684\u6548\u7387&#xff0c;\u56e0\u4e3a\u5b83\u907f\u514d\u4e86\u9012\u5f52\u8c03\u7528\u7684\u6808\u5f00\u9500\u3002<\/p>\n<h6>\u793a\u4f8b&#xff1a;\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7684\u8fed\u4ee3\u5b9e\u73b0<\/h6>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>\/\/ \u8fed\u4ee3\u5b9e\u73b0\u6590\u6ce2\u90a3\u5951\u6570\u5217<br \/>\nlong long fibonacci_iterative(int n) {<br \/>\n    if (n &#061;&#061; 0) {<br \/>\n        return 0;<br \/>\n    }<br \/>\n    if (n &#061;&#061; 1 || n &#061;&#061; 2) {<br \/>\n        return 1;<br \/>\n    }<\/p>\n<p>    long long a &#061; 1, b &#061; 1, c;<br \/>\n    for (int i &#061; 3; i &lt;&#061; n; i&#043;&#043;) {<br \/>\n        c &#061; a &#043; b;<br \/>\n        a &#061; b;<br \/>\n        b &#061; c;<br \/>\n    }<br \/>\n    return b;<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    int n &#061; 50;<br \/>\n    printf(&#034;\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7b2c%d\u9879: %lld\\\\n&#034;, n, fibonacci_iterative(n));<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7b2c50\u9879: 12586269025<\/p>\n<h4>6.7.5 \u9012\u5f52\u7684\u5e94\u7528\u573a\u666f<\/h4>\n<p>\u9012\u5f52\u7b97\u6cd5\u9002\u7528\u4e8e\u4ee5\u4e0b\u573a\u666f&#xff1a;<\/p>\n<ul>\n<li>\u6570\u636e\u7ed3\u6784\u662f\u9012\u5f52\u7684&#xff0c;\u5982\u94fe\u8868\u3001\u6811\u3001\u56fe\u7b49<\/li>\n<li>\u95ee\u9898\u53ef\u4ee5\u81ea\u7136\u5730\u5206\u89e3\u4e3a\u76f8\u4f3c\u7684\u5b50\u95ee\u9898&#xff0c;\u5982\u5206\u6cbb\u7b97\u6cd5<\/li>\n<li>\u9700\u8981\u904d\u5386\u6216\u641c\u7d22\u975e\u7ebf\u6027\u6570\u636e\u7ed3\u6784&#xff0c;\u5982\u6811\u7684\u904d\u5386\u3001\u56fe\u7684\u641c\u7d22<\/li>\n<li>\u9700\u8981\u751f\u6210\u6392\u5217\u3001\u7ec4\u5408\u6216\u5b50\u96c6\u7b49<\/li>\n<\/ul>\n<h3>6.8 \u51fd\u6570\u6307\u9488\u9ad8\u7ea7\u5e94\u7528<\/h3>\n<h4>6.8.1 \u51fd\u6570\u6307\u9488\u6570\u7ec4<\/h4>\n<p>\u51fd\u6570\u6307\u9488\u6570\u7ec4\u662f\u6307\u6570\u7ec4\u7684\u5143\u7d20\u662f\u51fd\u6570\u6307\u9488&#xff0c;\u53ef\u4ee5\u7528\u4e8e\u5b58\u50a8\u4e00\u7ec4\u7c7b\u578b\u76f8\u540c\u7684\u51fd\u6570\u6307\u9488&#xff0c;\u5b9e\u73b0\u51fd\u6570\u7684\u52a8\u6001\u9009\u62e9\u548c\u8c03\u7528\u3002<\/p>\n<h6>\u793a\u4f8b&#xff1a;\u8ba1\u7b97\u5668\u51fd\u6570\u6307\u9488\u6570\u7ec4<\/h6>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>\/\/ \u5b9a\u4e49\u51fd\u6570\u6307\u9488\u7c7b\u578b<br \/>\ntypedef double (*CalcFunc)(double, double);<\/p>\n<p>\/\/ \u7b97\u672f\u8fd0\u7b97\u51fd\u6570<br \/>\ndouble add(double a, double b) { return a &#043; b; }<br \/>\ndouble subtract(double a, double b) { return a &#8211; b; }<br \/>\ndouble multiply(double a, double b) { return a * b; }<br \/>\ndouble divide(double a, double b) { return b !&#061; 0 ? a \/ b : 0; }<\/p>\n<p>int main() {<br \/>\n    \/\/ \u51fd\u6570\u6307\u9488\u6570\u7ec4<br \/>\n    CalcFunc calc_funcs[] &#061; {add, subtract, multiply, divide};<br \/>\n    char operators[] &#061; {&#039;&#043;&#039;, &#039;-&#039;, &#039;*&#039;, &#039;\/&#039;};<br \/>\n    int num_ops &#061; sizeof(calc_funcs) \/ sizeof(calc_funcs[0]);<\/p>\n<p>    double a &#061; 10.5, b &#061; 2.5;<\/p>\n<p>    \/\/ \u4f7f\u7528\u51fd\u6570\u6307\u9488\u6570\u7ec4\u8c03\u7528\u4e0d\u540c\u7684\u51fd\u6570<br \/>\n    for (int i &#061; 0; i &lt; num_ops; i&#043;&#043;) {<br \/>\n        double result &#061; calc_funcs[i](a, b);<br \/>\n        printf(&#034;%.2f %c %.2f &#061; %.2f\\\\n&#034;, a, operators[i], b, result);<br \/>\n    }<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>10.50 &#043; 2.50 &#061; 13.00<br \/>\n10.50 &#8211; 2.50 &#061; 8.00<br \/>\n10.50 * 2.50 &#061; 26.25<br \/>\n10.50 \/ 2.50 &#061; 4.20<\/p>\n<h4>6.8.2 \u6307\u5411\u51fd\u6570\u6307\u9488\u7684\u6307\u9488<\/h4>\n<p>\u6307\u5411\u51fd\u6570\u6307\u9488\u7684\u6307\u9488&#xff08;Pointer to Function Pointer&#xff09;\u662f\u6307\u4e00\u4e2a\u6307\u9488&#xff0c;\u5b83\u6307\u5411\u4e00\u4e2a\u51fd\u6570\u6307\u9488\u53d8\u91cf\u3002\u8fd9\u79cd\u7ed3\u6784\u53ef\u4ee5\u7528\u4e8e\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u51fd\u6570\u52a8\u6001\u8c03\u7528\u3002<\/p>\n<h6>\u793a\u4f8b&#xff1a;\u6307\u5411\u51fd\u6570\u6307\u9488\u7684\u6307\u9488<\/h6>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>\/\/ \u51fd\u6570\u5b9a\u4e49<br \/>\nvoid func1() { printf(&#034;\u8c03\u7528\u4e86func1\\\\n&#034;); }<br \/>\nvoid func2() { printf(&#034;\u8c03\u7528\u4e86func2\\\\n&#034;); }<br \/>\nvoid func3() { printf(&#034;\u8c03\u7528\u4e86func3\\\\n&#034;); }<\/p>\n<p>int main() {<br \/>\n    \/\/ \u51fd\u6570\u6307\u9488\u53d8\u91cf<br \/>\n    void (*func_ptr)();<\/p>\n<p>    \/\/ \u6307\u5411\u51fd\u6570\u6307\u9488\u7684\u6307\u9488<br \/>\n    void (**func_ptr_ptr)() &#061; &amp;func_ptr;<\/p>\n<p>    \/\/ \u901a\u8fc7\u6307\u5411\u51fd\u6570\u6307\u9488\u7684\u6307\u9488\u8c03\u7528\u51fd\u6570<br \/>\n    *func_ptr_ptr &#061; func1;<br \/>\n    (**func_ptr_ptr)();  \/\/ \u8c03\u7528func1<\/p>\n<p>    *func_ptr_ptr &#061; func2;<br \/>\n    (**func_ptr_ptr)();  \/\/ \u8c03\u7528func2<\/p>\n<p>    *func_ptr_ptr &#061; func3;<br \/>\n    (**func_ptr_ptr)();  \/\/ \u8c03\u7528func3<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>\u8c03\u7528\u4e86func1<br \/>\n\u8c03\u7528\u4e86func2<br \/>\n\u8c03\u7528\u4e86func3<\/p>\n<h4>6.8.3 \u56de\u8c03\u51fd\u6570\u7684\u9ad8\u7ea7\u5e94\u7528<\/h4>\n<p>\u56de\u8c03\u51fd\u6570\u53ef\u4ee5\u7528\u4e8e\u5b9e\u73b0\u4e8b\u4ef6\u9a71\u52a8\u7f16\u7a0b\u3001\u5f02\u6b65\u7f16\u7a0b\u548c\u63d2\u4ef6\u7cfb\u7edf\u7b49\u9ad8\u7ea7\u5e94\u7528\u3002<\/p>\n<h6>\u793a\u4f8b&#xff1a;\u4e8b\u4ef6\u5904\u7406\u5668<\/h6>\n<p>#include &lt;stdio.h&gt;<br \/>\n#include &lt;string.h&gt;<\/p>\n<p>\/\/ \u4e8b\u4ef6\u7c7b\u578b\u5b9a\u4e49<br \/>\ntypedef enum {<br \/>\n    EVENT_CLICK,<br \/>\n    EVENT_KEYDOWN,<br \/>\n    EVENT_MOUSEMOVE,<br \/>\n    EVENT_QUIT<br \/>\n} EventType;<\/p>\n<p>\/\/ \u4e8b\u4ef6\u7ed3\u6784\u4f53<br \/>\ntypedef struct {<br \/>\n    EventType type;<br \/>\n    int x, y;       \/\/ \u9f20\u6807\u5750\u6807<br \/>\n    char key;       \/\/ \u6309\u952e<br \/>\n} Event;<\/p>\n<p>\/\/ \u56de\u8c03\u51fd\u6570\u7c7b\u578b\u5b9a\u4e49<br \/>\ntypedef void (*EventHandler)(const Event* event);<\/p>\n<p>\/\/ \u4e8b\u4ef6\u5904\u7406\u5668\u7ed3\u6784\u4f53<br \/>\ntypedef struct {<br \/>\n    EventHandler handlers[4];  \/\/ \u6bcf\u4e2a\u4e8b\u4ef6\u7c7b\u578b\u5bf9\u5e94\u4e00\u4e2a\u5904\u7406\u5668<br \/>\n} EventDispatcher;<\/p>\n<p>\/\/ \u521d\u59cb\u5316\u4e8b\u4ef6\u5206\u53d1\u5668<br \/>\nvoid init_event_dispatcher(EventDispatcher* dispatcher) {<br \/>\n    memset(dispatcher-&gt;handlers, 0, sizeof(dispatcher-&gt;handlers));<br \/>\n}<\/p>\n<p>\/\/ \u6ce8\u518c\u4e8b\u4ef6\u5904\u7406\u5668<br \/>\nvoid register_event_handler(EventDispatcher* dispatcher, EventType type, EventHandler handler) {<br \/>\n    dispatcher-&gt;handlers[type] &#061; handler;<br \/>\n}<\/p>\n<p>\/\/ \u89e6\u53d1\u4e8b\u4ef6<br \/>\nvoid dispatch_event(EventDispatcher* dispatcher, const Event* event) {<br \/>\n    EventHandler handler &#061; dispatcher-&gt;handlers[event-&gt;type];<br \/>\n    if (handler !&#061; NULL) {<br \/>\n        handler(event);<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ \u5177\u4f53\u4e8b\u4ef6\u5904\u7406\u51fd\u6570<br \/>\nvoid on_click(const Event* event) {<br \/>\n    printf(&#034;\u70b9\u51fb\u4e8b\u4ef6&#xff1a;x&#061;%d, y&#061;%d\\\\n&#034;, event-&gt;x, event-&gt;y);<br \/>\n}<\/p>\n<p>void on_keydown(const Event* event) {<br \/>\n    printf(&#034;\u6309\u952e\u4e8b\u4ef6&#xff1a;key&#061;%c\\\\n&#034;, event-&gt;key);<br \/>\n}<\/p>\n<p>void on_quit(const Event* event) {<br \/>\n    printf(&#034;\u9000\u51fa\u4e8b\u4ef6\\\\n&#034;);<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    EventDispatcher dispatcher;<br \/>\n    init_event_dispatcher(&amp;dispatcher);<\/p>\n<p>    \/\/ \u6ce8\u518c\u4e8b\u4ef6\u5904\u7406\u5668<br \/>\n    register_event_handler(&amp;dispatcher, EVENT_CLICK, on_click);<br \/>\n    register_event_handler(&amp;dispatcher, EVENT_KEYDOWN, on_keydown);<br \/>\n    register_event_handler(&amp;dispatcher, EVENT_QUIT, on_quit);<\/p>\n<p>    \/\/ \u6a21\u62df\u4e8b\u4ef6<br \/>\n    Event click_event &#061; {EVENT_CLICK, 100, 200, 0};<br \/>\n    Event keydown_event &#061; {EVENT_KEYDOWN, 0, 0, &#039;A&#039;};<br \/>\n    Event quit_event &#061; {EVENT_QUIT, 0, 0, 0};<\/p>\n<p>    \/\/ \u89e6\u53d1\u4e8b\u4ef6<br \/>\n    dispatch_event(&amp;dispatcher, &amp;click_event);<br \/>\n    dispatch_event(&amp;dispatcher, &amp;keydown_event);<br \/>\n    dispatch_event(&amp;dispatcher, &amp;quit_event);<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>\u70b9\u51fb\u4e8b\u4ef6&#xff1a;x&#061;100, y&#061;200<br \/>\n\u6309\u952e\u4e8b\u4ef6&#xff1a;key&#061;A<br \/>\n\u9000\u51fa\u4e8b\u4ef6<\/p>\n<h4>6.8.4 \u51fd\u6570\u6307\u9488\u4e0etypedef<\/h4>\n<p>\u4f7f\u7528typedef\u53ef\u4ee5\u4e3a\u51fd\u6570\u6307\u9488\u7c7b\u578b\u5b9a\u4e49\u4e00\u4e2a\u522b\u540d&#xff0c;\u4f7f\u4ee3\u7801\u66f4\u52a0\u7b80\u6d01\u548c\u6613\u8bfb\u3002<\/p>\n<h6>\u793a\u4f8b&#xff1a;typedef\u51fd\u6570\u6307\u9488<\/h6>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>\/\/ \u4f7f\u7528typedef\u5b9a\u4e49\u51fd\u6570\u6307\u9488\u7c7b\u578b<br \/>\ntypedef int (*MathFunc)(int, int);<br \/>\ntypedef void (*PrintFunc)(const char*);<\/p>\n<p>\/\/ \u7b97\u672f\u8fd0\u7b97\u51fd\u6570<br \/>\nint add(int a, int b) { return a &#043; b; }<br \/>\nint subtract(int a, int b) { return a &#8211; b; }<\/p>\n<p>\/\/ \u6253\u5370\u51fd\u6570<br \/>\nvoid print_info(const char* msg) { printf(&#034;[INFO] %s\\\\n&#034;, msg); }<br \/>\nvoid print_error(const char* msg) { printf(&#034;[ERROR] %s\\\\n&#034;, msg); }<\/p>\n<p>int main() {<br \/>\n    \/\/ \u4f7f\u7528typedef\u5b9a\u4e49\u7684\u51fd\u6570\u6307\u9488\u7c7b\u578b<br \/>\n    MathFunc math_func;<br \/>\n    PrintFunc print_func;<\/p>\n<p>    math_func &#061; add;<br \/>\n    printf(&#034;5 &#043; 3 &#061; %d\\\\n&#034;, math_func(5, 3));<\/p>\n<p>    math_func &#061; subtract;<br \/>\n    printf(&#034;5 &#8211; 3 &#061; %d\\\\n&#034;, math_func(5, 3));<\/p>\n<p>    print_func &#061; print_info;<br \/>\n    print_func(&#034;\u8fd9\u662f\u4e00\u6761\u4fe1\u606f&#034;);<\/p>\n<p>    print_func &#061; print_error;<br \/>\n    print_func(&#034;\u8fd9\u662f\u4e00\u6761\u9519\u8bef&#034;);<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>5 &#043; 3 &#061; 8<br \/>\n5 &#8211; 3 &#061; 2<br \/>\n[INFO] \u8fd9\u662f\u4e00\u6761\u4fe1\u606f<br \/>\n[ERROR] \u8fd9\u662f\u4e00\u6761\u9519\u8bef<\/p>\n<h3>6.9 \u5185\u8054\u51fd\u6570\u548c\u53ef\u53d8\u53c2\u6570\u51fd\u6570<\/h3>\n<h4>6.9.1 \u5185\u8054\u51fd\u6570<\/h4>\n<p>\u5185\u8054\u51fd\u6570&#xff08;Inline Function&#xff09;\u662f\u6307\u5728\u7f16\u8bd1\u65f6\u5c06\u51fd\u6570\u8c03\u7528\u66ff\u6362\u4e3a\u51fd\u6570\u4f53\u7684\u51fd\u6570&#xff0c;\u7528\u4e8e\u51cf\u5c11\u51fd\u6570\u8c03\u7528\u7684\u5f00\u9500&#xff0c;\u63d0\u9ad8\u7a0b\u5e8f\u7684\u6267\u884c\u6548\u7387\u3002<\/p>\n<p>\u5185\u8054\u51fd\u6570\u7684\u5b9a\u4e49\u8bed\u6cd5&#xff1a;<\/p>\n<p>inline \u8fd4\u56de\u503c\u7c7b\u578b \u51fd\u6570\u540d(\u53c2\u6570\u5217\u8868) {<br \/>\n    \/\/ \u51fd\u6570\u4f53<br \/>\n    return \u8fd4\u56de\u503c;<br \/>\n}<\/p>\n<h6>\u5185\u8054\u51fd\u6570\u7684\u6ce8\u610f\u4e8b\u9879<\/h6>\n<ul>\n<li>\u5185\u8054\u51fd\u6570\u9002\u7528\u4e8e\u51fd\u6570\u4f53\u77ed\u5c0f\u3001\u8c03\u7528\u9891\u7e41\u7684\u51fd\u6570<\/li>\n<li>\u5185\u8054\u51fd\u6570\u7684\u5b9a\u4e49\u901a\u5e38\u653e\u5728\u5934\u6587\u4ef6\u4e2d<\/li>\n<li>inline\u5173\u952e\u5b57\u53ea\u662f\u4e00\u4e2a\u5efa\u8bae&#xff0c;\u7f16\u8bd1\u5668\u53ef\u4ee5\u9009\u62e9\u5ffd\u7565<\/li>\n<li>\u9012\u5f52\u51fd\u6570\u3001\u5305\u542b\u5faa\u73af\u6216\u590d\u6742\u63a7\u5236\u6d41\u7684\u51fd\u6570\u4e0d\u9002\u5408\u4f5c\u4e3a\u5185\u8054\u51fd\u6570<\/li>\n<\/ul>\n<h6>\u793a\u4f8b&#xff1a;\u5185\u8054\u51fd\u6570<\/h6>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>\/\/ \u5185\u8054\u51fd\u6570&#xff0c;\u8ba1\u7b97\u4e24\u4e2a\u6570\u7684\u6700\u5927\u503c<br \/>\ninline int max(int a, int b) {<br \/>\n    return a &gt; b ? a : b;<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    int x &#061; 10, y &#061; 20;<br \/>\n    int z &#061; max(x, y);  \/\/ \u7f16\u8bd1\u65f6\u4f1a\u66ff\u6362\u4e3a&#xff1a;z &#061; x &gt; y ? x : y;<br \/>\n    printf(&#034;\u6700\u5927\u503c&#xff1a;%d\\\\n&#034;, z);<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>\u6700\u5927\u503c&#xff1a;20<\/p>\n<h4>6.9.2 \u53ef\u53d8\u53c2\u6570\u51fd\u6570<\/h4>\n<p>\u53ef\u53d8\u53c2\u6570\u51fd\u6570&#xff08;Variadic Function&#xff09;\u662f\u6307\u53c2\u6570\u6570\u91cf\u53ef\u53d8\u7684\u51fd\u6570&#xff0c;\u5982printf\u548cscanf\u51fd\u6570\u3002<\/p>\n<p>\u53ef\u53d8\u53c2\u6570\u51fd\u6570\u7684\u5b9a\u4e49\u9700\u8981\u4f7f\u7528stdarg.h\u5934\u6587\u4ef6\u4e2d\u7684\u5b8f&#xff1a;<\/p>\n<ul>\n<li>va_list&#xff1a;\u7528\u4e8e\u5b58\u50a8\u53ef\u53d8\u53c2\u6570\u5217\u8868<\/li>\n<li>va_start&#xff1a;\u521d\u59cb\u5316\u53ef\u53d8\u53c2\u6570\u5217\u8868<\/li>\n<li>va_arg&#xff1a;\u83b7\u53d6\u4e0b\u4e00\u4e2a\u53ef\u53d8\u53c2\u6570<\/li>\n<li>va_end&#xff1a;\u7ed3\u675f\u53ef\u53d8\u53c2\u6570\u7684\u83b7\u53d6<\/li>\n<\/ul>\n<h6>\u793a\u4f8b&#xff1a;\u81ea\u5b9a\u4e49\u53ef\u53d8\u53c2\u6570\u51fd\u6570<\/h6>\n<p>#include &lt;stdio.h&gt;<br \/>\n#include &lt;stdarg.h&gt;<\/p>\n<p>\/\/ \u8ba1\u7b97\u4efb\u610f\u6570\u91cf\u6574\u6570\u7684\u548c<br \/>\nint sum(int count, &#8230;) {<br \/>\n    va_list args;<br \/>\n    int total &#061; 0;<\/p>\n<p>    \/\/ \u521d\u59cb\u5316\u53ef\u53d8\u53c2\u6570\u5217\u8868<br \/>\n    va_start(args, count);<\/p>\n<p>    \/\/ \u83b7\u53d6\u53ef\u53d8\u53c2\u6570<br \/>\n    for (int i &#061; 0; i &lt; count; i&#043;&#043;) {<br \/>\n        int num &#061; va_arg(args, int);<br \/>\n        total &#043;&#061; num;<br \/>\n    }<\/p>\n<p>    \/\/ \u7ed3\u675f\u53ef\u53d8\u53c2\u6570\u7684\u83b7\u53d6<br \/>\n    va_end(args);<\/p>\n<p>    return total;<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    printf(&#034;sum(2, 10, 20) &#061; %d\\\\n&#034;, sum(2, 10, 20));<br \/>\n    printf(&#034;sum(3, 10, 20, 30) &#061; %d\\\\n&#034;, sum(3, 10, 20, 30));<br \/>\n    printf(&#034;sum(5, 1, 2, 3, 4, 5) &#061; %d\\\\n&#034;, sum(5, 1, 2, 3, 4, 5));<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p>sum(2, 10, 20) &#061; 30<br \/>\nsum(3, 10, 20, 30) &#061; 60<br \/>\nsum(5, 1, 2, 3, 4, 5) &#061; 15<\/p>\n<h6>\u53ef\u53d8\u53c2\u6570\u51fd\u6570\u7684\u6ce8\u610f\u4e8b\u9879<\/h6>\n<ul>\n<li>\u53ef\u53d8\u53c2\u6570\u51fd\u6570\u5fc5\u987b\u6709\u81f3\u5c11\u4e00\u4e2a\u56fa\u5b9a\u53c2\u6570<\/li>\n<li>\u53ef\u53d8\u53c2\u6570\u7684\u7c7b\u578b\u5fc5\u987b\u901a\u8fc7\u56fa\u5b9a\u53c2\u6570\u6216\u5176\u4ed6\u65b9\u5f0f\u786e\u5b9a<\/li>\n<li>\u4f7f\u7528va_arg\u65f6\u5fc5\u987b\u6307\u5b9a\u6b63\u786e\u7684\u53c2\u6570\u7c7b\u578b<\/li>\n<li>\u53ef\u53d8\u53c2\u6570\u51fd\u6570\u4e0d\u7c7b\u578b\u5b89\u5168&#xff0c;\u4f7f\u7528\u65f6\u8981\u683c\u5916\u5c0f\u5fc3<\/li>\n<\/ul>\n<h4>\u7ec3\u4e60\u9898<\/h4>\n<li>\u7f16\u5199\u4e00\u4e2a\u51fd\u6570&#xff0c;\u8ba1\u7b97\u4e24\u4e2a\u6570\u7684\u6700\u5927\u516c\u7ea6\u6570&#xff08;GCD&#xff09;\u3002<\/li>\n<li>\u7f16\u5199\u4e00\u4e2a\u51fd\u6570&#xff0c;\u8ba1\u7b97\u4e24\u4e2a\u6570\u7684\u6700\u5c0f\u516c\u500d\u6570&#xff08;LCM&#xff09;\u3002<\/li>\n<li>\u7f16\u5199\u4e00\u4e2a\u9012\u5f52\u51fd\u6570&#xff0c;\u8ba1\u7b97\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7684\u7b2cn\u9879&#xff0c;\u5e76\u4e0e\u8fed\u4ee3\u5b9e\u73b0\u6bd4\u8f83\u6548\u7387\u3002<\/li>\n<li>\u7f16\u5199\u4e00\u4e2a\u51fd\u6570&#xff0c;\u5c06\u4e00\u4e2a\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u9006\u5e8f\u6392\u5217\u3002<\/li>\n<li>\u7f16\u5199\u4e00\u4e2a\u51fd\u6570&#xff0c;\u5224\u65ad\u4e00\u4e2a\u6570\u662f\u5426\u4e3a\u7d20\u6570\u3002<\/li>\n<li>\u7f16\u5199\u4e00\u4e2a\u56de\u8c03\u51fd\u6570\u793a\u4f8b&#xff0c;\u5b9e\u73b0\u4e0d\u540c\u7684\u6392\u5e8f\u65b9\u5f0f\u3002<\/li>\n<h4>\u5b66\u4e60\u5efa\u8bae<\/h4>\n<ul>\n<li>\u7406\u89e3\u51fd\u6570\u7684\u57fa\u672c\u6982\u5ff5\u548c\u4f5c\u7528<\/li>\n<li>\u638c\u63e1\u51fd\u6570\u7684\u5b9a\u4e49\u3001\u58f0\u660e\u548c\u8c03\u7528\u65b9\u6cd5<\/li>\n<li>\u7406\u89e3\u53c2\u6570\u4f20\u9012\u65b9\u5f0f\u548c\u8fd4\u56de\u503c\u7684\u4f7f\u7528<\/li>\n<li>\u5b66\u4e60\u9012\u5f52\u51fd\u6570\u7684\u8bbe\u8ba1\u548c\u5b9e\u73b0<\/li>\n<li>\u7406\u89e3\u5c40\u90e8\u53d8\u91cf\u548c\u5168\u5c40\u53d8\u91cf\u7684\u533a\u522b<\/li>\n<li>\u638c\u63e1\u53d8\u91cf\u7684\u5b58\u50a8\u7c7b\u522b<\/li>\n<li>\u5b66\u4e60\u51fd\u6570\u6307\u9488\u548c\u56de\u8c03\u51fd\u6570\u7684\u4f7f\u7528<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c6\u7ae0 \u51fd\u65706.1 \u51fd\u6570\u6982\u8ff0\u51fd\u6570\u662fC\u8bed\u8a00\u4e2d\u6a21\u5757\u5316\u7f16\u7a0b\u7684\u57fa\u672c\u5355\u4f4d&#xff0c;\u5b83\u662f\u4e00\u4e2a\u5b8c\u6210\u7279\u5b9a\u529f\u80fd\u7684\u4ee3\u7801\u5757&#xff0c;\u53ef\u4ee5\u88ab\u91cd\u590d\u8c03\u7528\u3002\u51fd\u6570\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u590d\u7528\u6027\u3001\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002\u51fd\u6570\u7684\u7279\u70b9&#xff1a;\u51fd\u6570\u662f\u4e00\u4e2a\u72ec\u7acb\u7684\u4ee3\u7801\u5757&#xff0c;\u5b8c\u6210\u7279\u5b9a\u7684\u529f\u80fd\u51fd\u6570\u53ef\u4ee5\u88ab\u591a\u6b21\u8c03\u7528&#xff0c;\u63d0\u9ad8\u4ee3\u7801\u7684\u590d\u7528\u6027\u51fd\u6570\u53ef\u4ee5\u63a5\u6536\u8f93\u5165\u53c2\u6570&#xff0c;\u5e76\u8fd4\u56de\u8f93\u51fa\u7ed3\u679c\u51fd\u6570\u53ef\u4ee5\u9690\u85cf\u5185\u90e8\u5b9e\u73b0\u7ec6\u8282&#xff0c;\u53ea\u66b4\u9732\u63a5\u53e3C\u8bed\u8a00\u4e2d\u7684\u51fd\u6570\u5206\u7c7b&#xff1a;\u5e93\u51fd\u6570&#xff1a;\u7531C\u8bed\u8a00\u6807\u51c6\u5e93<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7000,7001,55,174,6205,190,427],"topic":[],"class_list":{"0":"post-66172","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-server","7":"tag-7000","8":"tag-7001","9":"tag-c","11":"tag-6205","12":"tag-190","13":"tag-427"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C\u8bed\u8a0014\u7ae0\u96f6\u57fa\u7840\u5e72\u8d27 \u7b2c\u516d\u7ae0 - \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\/66172.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C\u8bed\u8a0014\u7ae0\u96f6\u57fa\u7840\u5e72\u8d27 \u7b2c\u516d\u7ae0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u7b2c6\u7ae0 \u51fd\u65706.1 \u51fd\u6570\u6982\u8ff0\u51fd\u6570\u662fC\u8bed\u8a00\u4e2d\u6a21\u5757\u5316\u7f16\u7a0b\u7684\u57fa\u672c\u5355\u4f4d&#xff0c;\u5b83\u662f\u4e00\u4e2a\u5b8c\u6210\u7279\u5b9a\u529f\u80fd\u7684\u4ee3\u7801\u5757&#xff0c;\u53ef\u4ee5\u88ab\u91cd\u590d\u8c03\u7528\u3002\u51fd\u6570\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u590d\u7528\u6027\u3001\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002\u51fd\u6570\u7684\u7279\u70b9&#xff1a;\u51fd\u6570\u662f\u4e00\u4e2a\u72ec\u7acb\u7684\u4ee3\u7801\u5757&#xff0c;\u5b8c\u6210\u7279\u5b9a\u7684\u529f\u80fd\u51fd\u6570\u53ef\u4ee5\u88ab\u591a\u6b21\u8c03\u7528&#xff0c;\u63d0\u9ad8\u4ee3\u7801\u7684\u590d\u7528\u6027\u51fd\u6570\u53ef\u4ee5\u63a5\u6536\u8f93\u5165\u53c2\u6570&#xff0c;\u5e76\u8fd4\u56de\u8f93\u51fa\u7ed3\u679c\u51fd\u6570\u53ef\u4ee5\u9690\u85cf\u5185\u90e8\u5b9e\u73b0\u7ec6\u8282&#xff0c;\u53ea\u66b4\u9732\u63a5\u53e3C\u8bed\u8a00\u4e2d\u7684\u51fd\u6570\u5206\u7c7b&#xff1a;\u5e93\u51fd\u6570&#xff1a;\u7531C\u8bed\u8a00\u6807\u51c6\u5e93\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/66172.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-26T03:48:59+00:00\" \/>\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=\"13 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/66172.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/66172.html\",\"name\":\"C\u8bed\u8a0014\u7ae0\u96f6\u57fa\u7840\u5e72\u8d27 \u7b2c\u516d\u7ae0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-26T03:48:59+00:00\",\"dateModified\":\"2026-01-26T03:48:59+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/66172.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/66172.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/66172.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C\u8bed\u8a0014\u7ae0\u96f6\u57fa\u7840\u5e72\u8d27 \u7b2c\u516d\u7ae0\"}]},{\"@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\u8a0014\u7ae0\u96f6\u57fa\u7840\u5e72\u8d27 \u7b2c\u516d\u7ae0 - \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\/66172.html","og_locale":"zh_CN","og_type":"article","og_title":"C\u8bed\u8a0014\u7ae0\u96f6\u57fa\u7840\u5e72\u8d27 \u7b2c\u516d\u7ae0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u7b2c6\u7ae0 \u51fd\u65706.1 \u51fd\u6570\u6982\u8ff0\u51fd\u6570\u662fC\u8bed\u8a00\u4e2d\u6a21\u5757\u5316\u7f16\u7a0b\u7684\u57fa\u672c\u5355\u4f4d&#xff0c;\u5b83\u662f\u4e00\u4e2a\u5b8c\u6210\u7279\u5b9a\u529f\u80fd\u7684\u4ee3\u7801\u5757&#xff0c;\u53ef\u4ee5\u88ab\u91cd\u590d\u8c03\u7528\u3002\u51fd\u6570\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u590d\u7528\u6027\u3001\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002\u51fd\u6570\u7684\u7279\u70b9&#xff1a;\u51fd\u6570\u662f\u4e00\u4e2a\u72ec\u7acb\u7684\u4ee3\u7801\u5757&#xff0c;\u5b8c\u6210\u7279\u5b9a\u7684\u529f\u80fd\u51fd\u6570\u53ef\u4ee5\u88ab\u591a\u6b21\u8c03\u7528&#xff0c;\u63d0\u9ad8\u4ee3\u7801\u7684\u590d\u7528\u6027\u51fd\u6570\u53ef\u4ee5\u63a5\u6536\u8f93\u5165\u53c2\u6570&#xff0c;\u5e76\u8fd4\u56de\u8f93\u51fa\u7ed3\u679c\u51fd\u6570\u53ef\u4ee5\u9690\u85cf\u5185\u90e8\u5b9e\u73b0\u7ec6\u8282&#xff0c;\u53ea\u66b4\u9732\u63a5\u53e3C\u8bed\u8a00\u4e2d\u7684\u51fd\u6570\u5206\u7c7b&#xff1a;\u5e93\u51fd\u6570&#xff1a;\u7531C\u8bed\u8a00\u6807\u51c6\u5e93","og_url":"https:\/\/www.wsisp.com\/helps\/66172.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-26T03:48:59+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"13 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/66172.html","url":"https:\/\/www.wsisp.com\/helps\/66172.html","name":"C\u8bed\u8a0014\u7ae0\u96f6\u57fa\u7840\u5e72\u8d27 \u7b2c\u516d\u7ae0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-26T03:48:59+00:00","dateModified":"2026-01-26T03:48:59+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/66172.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/66172.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/66172.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"C\u8bed\u8a0014\u7ae0\u96f6\u57fa\u7840\u5e72\u8d27 \u7b2c\u516d\u7ae0"}]},{"@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\/66172","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=66172"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/66172\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=66172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=66172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=66172"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=66172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}