{"id":100,"date":"2023-11-18T17:32:14","date_gmt":"2023-11-18T09:32:14","guid":{"rendered":"http:\/\/124.220.62.22\/?p=100"},"modified":"2024-01-23T16:01:24","modified_gmt":"2024-01-23T08:01:24","slug":"%e5%a4%9a%e7%bb%b4%e6%95%b0%e7%bb%84%e7%9a%84%e6%9c%ac%e8%b4%a8","status":"publish","type":"post","link":"http:\/\/blog.chxzking.cn\/index.php\/2023\/11\/18\/%e5%a4%9a%e7%bb%b4%e6%95%b0%e7%bb%84%e7%9a%84%e6%9c%ac%e8%b4%a8\/","title":{"rendered":"\u8bba\u6570\u7ec4"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u6570\u7ec4\u662f\u4ec0\u4e48\uff1f<\/h2>\n\n\n\n<p class=\"has-black-color has-text-color wp-block-paragraph\">       \u4ece\u672c\u8d28\u4e0a\u6765\u8bb2\uff0c\u6570\u7ec4\u662f\u4e00\u4e2a\u76f8\u540c\u7c7b\u578b\u7684\u6570\u636e\u96c6\u5408\uff0c\u5982 <code>int a[10]<\/code> \u672c\u8d28\u4e0a\u662f10\u4e2a <code>int<\/code> \u7c7b\u578b\u7684\u6570\u7d27\u5bc6\u5730\u7f57\u5217\u5728\u4e00\u8d77\uff0c\u5e76\u4e14\u5728\u5730\u5740\u4e0a\u6784\u6210\u8fde\u7eed\u3002\u6bd4\u5982\u5730\u5740\u4ece0x00~0x40\uff08\u56e0\u4e3a <code>int<\/code> \u5360\u56db\u4e2a\u5b57\u8282\uff09\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">       \u63a5\u4e0b\u6765\u8981\u63d0\u5230\u7684\u662f<strong>\u6570\u7ec4\u540d<\/strong>\uff0c\u6570\u7ec4\u540d\u5176\u5b9e\u662f\u4e00\u4e2a<strong>\u5730\u5740<\/strong>\uff08\u786e\u5207\u7684\u8bf4\uff0c\u6570\u7ec4\u540d\u662f\u4e00\u4e2a<strong>\u6307\u9488\u5e38\u91cf<\/strong>\uff0c\u8fd9\u4e2a\u6307\u9488\u5b58\u653e\u7740\u6570\u7ec4\u7684<strong>\u9996\u5143\u7d20<\/strong>\u5730\u5740\uff0c\u53ea\u662f\u4e60\u60ef\u4e0a\u4f1a\u8bf4\u6570\u7ec4\u540d\u662f\u4e00\u4e2a\u5730\u5740\uff09\uff0c\u800c\u8fd9\u4e2a\u5730\u5740\u662f\u8fd9\u4e2a\u6570\u7ec4<strong>\u9996\u5143\u7d20<\/strong>\u7684\u5730\u5740\u3002\u8981\u6ce8\u610f\u7684\u4e00\u70b9\u662f\uff0c\u6570\u7ec4\u7684\u5730\u5740\u548c\u6570\u7ec4\u9996\u5143\u7d20\u7684\u5730\u5740\u662f\u6709\u533a\u522b\u7684\uff0c\u6211\u4eec\u7528\u4e0b\u9762\u7684\u4f8b\u5b50\u6765\u5206\u6790\u4e00\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\n\nint main(){\n    \/\/\u6211\u4f7f\u7528\u4e8c\u7ef4\u6570\u7ec4\u662f\u65b9\u4fbf\u4e3e\u4f8b\u8bba\u8bc1\uff0c\u8bfb\u8005\u5728\u8fd9\u91cc\u4e5f\u8bb8\u4f1a\u6709\u4e9b\u8ff7\u60d1\uff0c\u4e0d\u8fc7\u4e0d\u8981\u7d27\uff0c\u540e\u9762\u4f1a\u89e3\u91ca\u6e05\u695a\n    \/\/\u6b64\u5904\u4f60\u53ef\u4ee5\u7b80\u5355\u7684\u770b\u6210\u4e00\u4e2aint a&#91;2]\u7684\u4e00\u4f4d\u6570\u7ec4\uff0c\u5176\u4ed6\u7684\u8bf7\u6682\u65f6\u5ffd\u7565\n    \/\/\u5982\u679c\u5b9e\u5728\u770b\u4e0d\u61c2\uff0c\u8bf7\u76f4\u63a5\u8df3\u8fc7\u4ee3\u7801\u770b\u7ed3\u8bba\uff0c\u5728\u672c\u7ae0\u9605\u8bfb\u5b8c\u6210\u540e\u4f60\u5c31\u80fd\u770b\u61c2\u4e86\n    int a&#91;2]&#91;2] = {1,2,3,4};\n    \/\/\u6b64\u5904\u53ef\u4ee5\u7b80\u5355\u770b\u6210 int *p = &amp;a;\n    int (*p)&#91;2] = &amp;a;\n\n    \/\/\u8fd9\u4e00\u6bb5\uff0c\u4f60\u53ef\u770b\u4f5ca&#91;0]\u7684\u5730\u5740\u548ca&#91;1]\u7684\u5730\u5740\n    printf(\"\u9996\u5143\u7d20a&#91;0]\u7684\u5730\u5740\uff1a%p\\n\",&amp;a&#91;0]&#91;0]);\n    printf(\"\u7b2c\u4e8c\u4e2a\u5143\u7d20a&#91;1]\u7684\u5730\u5740:%p\\n\",&amp;a&#91;0]&#91;1]);\n\n    \/\/\u8fd9\u4e00\u6bb5\u53ef\u4ee5\u7b80\u5355\u7684\u770b\u4f5c\u6574\u4e2a\u6570\u7ec4a\u7684\u5730\u5740\u548c\u4e0b\u4e00\u4e2a\u5185\u5b58\u4e2d\u5730\u5740\n    printf(\"\u6570\u7ec4a\u7684\u5730\u5740\uff1a%p\\n\",p&#91;0]);\n    printf(\"\u5728\u5185\u5b58\u4e2d\u7d27\u6328\u7740\u6570\u7ec4a\u7684\u4e0b\u4e00\u4e2a\u5730\u5740\uff1a%p\\n\",p&#91;1]);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">\u8fd0\u884c\u7ed3\u679c\uff1a<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u9996\u5143\u7d20a[0]\u7684\u5730\u5740\uff1a    0x7fffcdb9b200<br>\u7b2c\u4e8c\u4e2a\u5143\u7d20a[1]\u7684\u5730\u5740:0x7fffcdb9b204<br>\u6570\u7ec4a\u7684\u5730\u5740\uff1a            0x7fffcdb9b200<br>\u5728\u5185\u5b58\u4e2d\u7d27\u6328\u7740\u6570\u7ec4a\u7684\u4e0b\u4e00\u4e2a\u5730\u5740\uff1a0x7fffcdb9b208<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7ed3\u8bba\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u5728\u4ee3\u7801\u903b\u8f91\u4e2d\u5047\u8bbe\u4e86\u4e00\u4e2a int a[2] \u7684\u6570\u7ec4\uff0c\u4ece\u7ed3\u679c\u4e0a\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c\u6570\u7ec4\u7684<strong>\u9996\u5143\u7d20\u5730\u5740<\/strong>\u548c<strong>\u6570\u7ec4\u7684\u5730\u5740<\/strong>\u90fd\u662f0x7fffcdb9b200\uff0c\u4f46\u662f\u4e00\u4e2a\u6307\u9488\u4ece\u9996\u5143\u7d20\u5730\u5740\u79fb\u52a8\u5230\u4e0b\u4e00\u4e2a\u5185\u5b58\u5730\u5740(0x7fffcdb9b204)\u6b65\u957f\u662f4,\u800c\u4e00\u4e2a\u6307\u5411\u6574\u4e2a\u6570\u7ec4\u7684\u6307\u9488\uff0c\u79fb\u52a8\u5230\u4e0b\u4e00\u4e2a\u5185\u5b58\u5730\u5740(0x7fffcdb9b208)\u540e\uff0c\u6b65\u957f\u5374\u662f8\uff0c\u521a\u597d\u662f\u6211\u4eec\u4e3e\u4f8b\u7684a[2]\u7a7a\u95f4\u7684\u603b\u5927\u5c0f\uff0c<strong>\u6a2a\u8de8\u4e86\u6574\u4e2a\u6570\u7ec4<\/strong>\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6240\u4ee5\u6211\u4eec\u603b\u7ed3\u4e00\u4e0b\uff0c\u6570\u7ec4\u540d\u662f\u6570\u7ec4\u9996\u5143\u7d20\u7684\u5730\u5740\uff0c\u800c\u6570\u7ec4\u5730\u5740\u662f\u6574\u4e2a\u6570\u7ec4\u7684\u5730\u5740\uff0c\u4e24\u4e2a\u5730\u5740\u867d\u7136\u4e00\u6837\uff0c\u4f46\u662f\u5728\u6027\u8d28\u4e0a\u6709<strong>\u672c\u8d28<\/strong>\u7684\u533a\u522b\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6570\u7ec4\u4e0e\u6307\u9488<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u65e2\u7136\u6211\u4eec\u5728\u4e0a\u6587\u4e2d\u63d0\u5230\u4e86\u6570\u7ec4\u540d\u662f\u4e00\u4e2a\u6307\u5411\u6570\u7ec4\u9996\u5143\u7d20\u5730\u5740\u7684\u6307\u9488\u5e38\u91cf\uff0c\u90a3\u4e48\u6570\u7ec4\u5c31\u5fc5\u7136\u5728\u547d\u8fd0\u4e2d\u548c\u6307\u9488\u7ed1\u5728\u4e86\u4e00\u8d77\uff0c\u63a5\u4e0b\u6765\u5c31\u8ba9\u6211\u4eec\u770b\u4e00\u770b\u6570\u7ec4\u548c\u6307\u9488\u7684\u5173\u7cfb\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u5df2\u7ecf\u77e5\u9053\u4e86\u6570\u7ec4\u540d\u548c\u5730\u5740\u6709\u7740\u4e0d\u53ef\u5206\u5272\u7684\u5173\u7cfb\uff0c\u6307\u9488\u53c8\u548c\u5730\u5740\u7d27\u5bc6\u76f8\u8fde\uff0c\u90a3\u4e48\u6211\u4eec\u540c\u6837\u53ef\u4ee5\u60f3\u5230\u7528\u6307\u9488\u6765\u8bbf\u95ee\u6570\u7ec4\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\nint main(){\n    int a&#91;2]={1,10};\n    int *p = a;\n    printf(\"*p = %d\\n \",*p);\n    printf(\"*(p+1) = %d\\n\",*(p+1));\n\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">\u8fd0\u884c\u7ed3\u679c<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">*p = 1<br>*(p+1) = 10<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u7528\u4e00\u4e2a<code>p<\/code>\u5b58\u653e\u4e86\u6570\u7ec4\u9996\u5143\u7d20\u7684\u6307\u9488\uff0c\u90a3\u4e48\u7406\u6240\u5f53\u7136\uff0c\u6211\u4eec\u89e3\u5f15\u7528<code>*p<\/code>\u4e4b\u540e\u5c31\u662f<code>a[0]<\/code>\u4e2d\u5b58\u50a8\u7684\u6570\u636e1\uff0c\u90a3\u4e48\u6211\u4eec\u7ed9<code>\uff08p+1\uff09<\/code>\u7684\u610f\u601d\u4e5f\u5c31\u662f\u8ba9\u6307\u9488\u5411\u540e\u79fb\u52a8\u4e00\u4f4d\uff0c\u4f46\u6211\u4eec\u524d\u6587\u8bf4\u8fc7\uff0c\u6570\u7ec4\u4e2d\u5143\u7d20\u7684\u5730\u5740\u662f\u8fde\u7eed\u7684\uff0c\u90a3\u4e48\u8fd9\u4e2a\u6307\u9488\u5c31\u79fb\u5230\u4e86<code>a[1]<\/code>\u7684\u5730\u5740\uff0c\u7136\u540e\u6211\u4eec\u5c06\u5176\u89e3\u5f15\u7528<code>*(p+1)<\/code>\u5f97\u5230\u7684\u7ed3\u679c\u5c31\u662f<code>a[1]<\/code>\u4e2d\u5b58\u50a8\u7684\u6570\u636e<code>10<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u76f8\u4fe1\u770b\u5230\u4e86\u8fd9\u91cc\uff0c\u8bfb\u8005\u5fc3\u4e2d\u53ef\u80fd\u6709\u7591\u95ee\u2014\u2014\u65e2\u7136p\u80fd+1\u79fb\u52a8\u5730\u5740\uff0c\u90a3\u6211\u7528a+1\u4e0d\u4e5f\u53ef\u4ee5\u5417\uff1f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5176\u5b9e\u8fd9\u4e5f\u662f\u5f88\u591a\u521d\u5b66\u8005\u7684\u8bef\u533a\uff0c\u6211\u4eec\u5728\u4e0a\u6587\u63d0\u5230\u8fc7\uff0c\u6570\u7ec4\u540d\u672c\u8d28\u662f\u4e00\u4e2a\u6307\u9488\u5e38\u91cf\uff0c\u8fd9\u4e5f\u5c31\u51b3\u5b9a\u4e86\u6570\u7ec4\u540d\u662f\u4e0d\u80fd\u8fdb\u884c\u8fd0\u7b97\u7684\uff0c\u4f60\u53ef\u4ee5\u6539\u53d8\u6570\u7ec4\u540d\u5730\u5740\u5bf9\u5e94\u7684\u503c\uff0c\u4f46\u65e0\u6cd5\u6539\u53d8\u6570\u7ec4\u540d\u5bf9\u5e94\u7684\u5730\u5740\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\n\nint main(){\n    int a&#91;2]={1,10};\n    a++;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">\u8fd0\u884c\u7ed3\u679c<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">1.c: In function \u2018main\u2019:<br>1.c:5:6: error: lvalue required as increment operand<br>5 | a++;<\/mark><br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f88\u660e\u663e\u7f16\u8bd1\u5668\u5728\u8fd9\u91cc\u629b\u51fa\u4e86\u4e00\u4e2a\u9519\u8bef\uff0c\u5176\u5b9e\u6211\u4eec\u4ed4\u7ec6\u601d\u8003\u4e00\u4e0b\u4e5f\u80fd\u60f3\u660e\u767d\uff0c\u5982\u679c\u6570\u7ec4\u540d\u5b58\u653e\u7684\u5730\u5740\u6539\u53d8\u4e86\uff0c\u662f\u4e0d\u662f\u4e5f\u5c31\u610f\u5473\u7740\u8fd9\u4e2a\u6570\u7ec4\u5728\u5185\u5b58\u4e2d\u5c31\u65e0\u6cd5\u5f88\u597d\u7684\u8fdb\u884c\u5b9a\u4f4d\u4e86\uff0c\u5c4a\u65f6\u53ef\u80fd\u4f1a\u9020\u6210\u5404\u79cd\u5947\u602a\u7684\u95ee\u9898\uff0c\u5f53\u7136\uff0c\u6211\u60f3C\u8bed\u8a00\u7684\u5f00\u53d1\u4eba\u5458\u53ef\u80fd\u4f1a\u8003\u8651\u7684\u66f4\u591a\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6307\u9488\u6570\u7ec4\u4e0e\u6570\u7ec4\u6307\u9488<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u521d\u5b66\u8005\u770b\u5230\u8fd9\u4e00\u4e2a\u6807\u9898\u7684\u65f6\u5019\u4f30\u8ba1\u5fc3\u4e2d\u53ef\u80fd\u6709\u7591\u95ee\u2014\u2014\u8fd9\u4e0d\u662f\u4e00\u6837\u7684\u5417\uff1f\u5176\u5b9e\u4e0d\u7136\uff0c\u8fd9\u4e24\u4e2a\u8bcd\u6709\u7740\u672c\u8d28\u7684\u533a\u522b\uff0c\u8ba9\u6211\u4eec\u53bb\u6389\u8fd9\u4e24\u4e2a\u8bcd\u524d\u9762\u7684\u4fee\u9970\uff0c\u662f\u4e0d\u662f\u6807\u9898\u5c31\u53d8\u6210\u4e86\u201d\u6570\u7ec4\u4e0e\u6307\u9488\u201c\u4e86\u3002\u90a3\u6211\u4eec\u63a5\u4e0b\u6765\u5c31\u4ed4\u7ec6\u63a2\u8ba8\u4e00\u4e0b\u8fd9\u5bf9\u201d\u86ee\u751f\u5144\u5f1f\u201c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u9996\u5148\u6211\u4eec\u6765\u8bf4\u8bf4\u6307\u9488\u6570\u7ec4\uff0c\u987e\u540d\u601d\u4e49\u5c31\u662f\u5b58\u653e\u6307\u9488\u7684\u6570\u7ec4\u3002\u6bd4\u5982<code> int *p[10]<\/code> ;\u6211\u4eec\u6765\u5206\u6790\u4e00\u4e0b\uff0c\u5148\u60f3\u4e00\u60f3 <code> * <\/code>\u548c <code>[]<\/code> \u7684\u4f18\u5148\u7ea7\uff0c\u6211\u4eec\u901a\u8fc7\u5404\u79cd\u9014\u5f84\u90fd\u80fd\u4e86\u89e3\u5230\uff0c<code>[]<\/code>\u7684\u4f18\u5148\u7ea7\u662f\u9ad8\u4e8e<code> *<\/code> \u7684\uff0c\u6240\u4ee5<code>p<\/code>\u4f1a\u548c<code>[]<\/code>\u5148\u7ed3\u5408\uff0c\u6211\u4eec\u518d\u770b\u4e00\u770b<code>p[]<\/code>\u662f\u4ec0\u4e48\uff0c\u663e\u7136\u8fd9\u662f\u4e00\u4e2a\u6570\u7ec4\uff0c\u5c06<code>int *p[10]<\/code>\u8fde\u8d77\u6765\u770b\uff0c\u5c31\u662f\u6709\u4e00\u4e2a\u540d\u4e3ap\u7684\u6570\u7ec4,\u5b83\u670910\u4e2a\u5143\u7d20\uff0c\u6bcf\u4e2a\u5143\u7d20\u662f<code>int*<\/code>\u7c7b\u578b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\nint main(){\n    int a=1,b=10,c=100;\n    int *p&#91;3]={&amp;a,&amp;b,&amp;c};\n    for(int i=0;i&lt;3;i++){\n        printf(\"p&#91;%d] = %p\\n\",i,p&#91;i]);\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">\u8fd0\u884c\u7ed3\u679c<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">p[0] = 0x7ffe0311c7a8<br>p[1] = 0x7ffe0311c7a4<br>p[2] = 0x7ffe0311c7a0<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u7a0b\u5e8f\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u5c31\u80fd\u5f88\u6e05\u695a\u7684\u5c31\u80fd\u770b\u5230p\u7684\u4e09\u4e2a\u5143\u7d20\u662f\u4ec0\u4e48\uff0c\u8fd9\u5c31\u662f\u6307\u9488\u6570\u7ec4\uff0c\u4e00\u4e2a\u5b58\u653e\u6307\u9488\u7684\u6570\u7ec4\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u4e0b\u6765\u6211\u4eec\u804a\u804a\u6570\u7ec4\u6307\u9488\uff0c\u6709\u4e86\u524d\u9762\u7684\u7ecf\u9a8c\uff0c\u6211\u4eec\u4ed4\u7ec6\u77a7\u4e00\u77a7\u8fd9\u4e2a\u7ed3\u6784 <code>int (*p)[3] <\/code>\uff1b\u5728\u8fd9\u91cc\u6211\u4eec\u7684*\u88ab<code>\uff08\uff09<\/code>\u62ec\u4e86\u8d77\u6765\uff0c\u6240\u4ee5<code>*<\/code>\u548c<code>p<\/code>\u5148\u7ed3\u5408\uff0c\u90a3\u4e48<code>*p<\/code>\u662f\u4ec0\u4e48\u5462\uff1f\u663e\u7136\u8fd9\u662f\u4e00\u4e2a\u6307\u9488\uff0c\u8ba9\u6211\u4eec\u628a\u5176\u4ed6\u7684\u52a0\u4e0a\uff1a <code>int (*p)[3]<\/code> ;\u8fd9\u5c31\u662f\u4e00\u4e2a\u6307\u5411\u6709\u4e09\u4e2a\u5143\u7d20\u7684\u6570\u7ec4\u7684\u6307\u9488\uff0c\u6211\u4eec\u524d\u9762\u5b66\u8fc7\u4e86\u6570\u7ec4\u540d\u662f\u4e00\u4e2a\u6570\u7ec4\u9996\u5143\u7d20\u7684\u5730\u5740\uff0c\u5047\u8bbe\u4e00\u4e2a\u6570\u7ec4<code>int a[3]<\/code>,\u5728\u6570\u7ec4\u540d\u524d\u52a0<code>&amp;<\/code>\u5c31\u662f\u53d6\u6574\u4e2a\u6570\u7ec4\u7684\u5730\u5740\uff0c\u4f46\u662f\u53d6\u4e86\u4e4b\u540e\uff0c\u6211\u4eec\u600e\u4e48\u7528\u6307\u9488\u6765\u63a5\u5462\uff1f<code>int *<\/code>?\u8fd9\u663e\u7136\u4e0d\u80fd\uff0c\u56e0\u4e3a\u73b0\u5728\u7684\u5730\u5740\u6027\u8d28\u662f\u6570\u7ec4\uff0c\u4e00\u4e2a\u5c0f\u5c0f\u7684<code>int*<\/code>\u80af\u5b9a\u63a5\u4e0d\u4f4f\uff0c\u90a3\u4e48<code> int(*p)[3] <\/code> \u5c31\u5e94\u8fd0\u800c\u751f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\nint main(){\n    int a&#91;3]={1,2,3};\n    int (*p)&#91;3] = &amp;a;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u5c31\u662f\u6570\u7ec4\u6307\u9488\u7684\u57fa\u672c\u7528\u6cd5\uff0c\u4f46\u662f\u6570\u7ec4\u6307\u9488\u7279\u6b8a\u7684\u5730\u65b9\u662f\uff0c\u5b83\u5b58\u653e\u7684\u662f\u4e00\u4e2a\u6570\u7ec4\u7684\u5730\u5740\uff0c\u6211\u4eec\u901a\u5e38\u4e0d\u4f1a\u5355\u72ec\u8fdb\u884c<code> *(p+1) <\/code>\u7684\u89e3\u5f15\u7528\u64cd\u4f5c\uff0c\u56e0\u4e3a\u6211\u4eec\u4e0d\u77e5\u9053\u4e0b\u4e00\u4e2a\u5185\u5b58\u662f\u4ec0\u4e48\uff0c\u8fd9\u79cd\u64cd\u4f5c\u662f\u6ca1\u6709\u610f\u4e49\u7684\uff0c\u6307\u9488\u6570\u7ec4\u901a\u5e38\u4f7f\u7528\u5728\u591a\u7ef4\u6570\u7ec4\u4e0a\uff0c\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u6211\u4f1a\u5728\u8ba8\u8bba\u201d\u6570\u7ec4\u662f\u4ec0\u4e48\u201c\u7684\u65f6\u5019\u7528\u4e8c\u7ef4\u6570\u7ec4\u6765\u8ba8\u8bba\u7684\u539f\u56e0\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0d\u8fc7\u6709\u4e00\u70b9\u503c\u5f97\u6ce8\u610f\uff0c\u6570\u7ec4\u6307\u9488\u548c\u6570\u7ec4\u7684[]\u91cc\u9762\u7684\u6570\u662f\u5bf9\u5e94\u7684\uff0c\u4e00\u4e2a\u841d\u535c\u4e00\u4e2a\u5751\uff0c\u5fc5\u987b\u8981\u4e00\u4e00\u5bf9\u5e94\uff0c\u4ee5\u4e0b\u884c\u4e3a\u5c31\u662f\u8bed\u6cd5\u9519\u8bef\u7684\u5178\u8303\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\n\nint main(){\n    int a&#91;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">3<\/mark>]={1,2,3};\n    int (*p)&#91;<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">2<\/mark><\/strong>] = &amp;a;\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u591a\u7ef4\u6570\u7ec4<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u5728\u4e0a\u4e2a\u6a21\u5757\u5c31\u6d89\u53ca\u5230\u4e86\u591a\u7ef4\u6570\u7ec4\uff0c\u90a3\u4e48\u8fd9\u4e2a\u6a21\u5757\u6211\u4eec\u5c31\u62ff\u4e8c\u7ef4\u6570\u7ec4\u4f5c\u4e3a\u4ee3\u8868\u6765\u8bb2\u4e00\u8bb2\uff0c\u56e0\u4e3a\u591a\u7ef4\u6570\u7ec4\u5176\u5b9e\u662f\u76f8\u901a\u7684\uff0c\u4f60\u770b\u61c2\u4e86\u4e8c\u7ef4\u6570\u7ec4\uff0c\u591a\u7ef4\u6570\u7ec4\u4e5f\u5c31\u61c2\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u6837\u7684\uff0c\u6211\u4eec\u6765\u770b\u770b\u4f8b\u5b50\uff1a int a[2][3] ;\u6211\u4eec\u4ece\u5f62\u5f0f\u4e0a\u5e94\u8be5\u80fd\u5927\u81f4\u731c\u6d4b\u51faa\u4ee3\u8868\u7684\u662f\u4e00\u4e2a2\u884c3\u5217\u7684\u6570\u7ec4\uff0c\u5f53\u7136\u8fd9\u662f\u903b\u8f91\u4e0a\u7684\uff0c\u5176\u5b9e\u5b83\u5728\u5185\u5b58\u4e2d\u7684\u672c\u8d28\u8fd8\u662f\u4e00\u7ef4\u6570\u7ec4\uff0c\u63a5\u4e0b\u6765\u8bf7\u542c\u6211\u4ed4\u7ec6\u5206\u6790\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\n int main(){\n    int a&#91;2]&#91;3]={1,2,3,4,5,6};\n    int (*p)&#91;3] = &amp;a;\n    printf(\"&amp;a = %p\\n\",&amp;a);\n    printf(\"a = %p\\n\",a); \n    printf(\"p&#91;0] = %p\\n\", p&#91;0]);\n    printf(\"p&#91;1] = %p\\n\", p&#91;1]);\n    for(int i = 0;i&lt;2;i++){ \n        for(int j=0;j&lt;3;j++){\n            printf(\"&amp;a&#91;%d]&#91;%d] = %p \\n\",i,j,&amp;a&#91;i]&#91;j]);\n        } \n    } \n    printf(\"\\n\");\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">\u8fd0\u884c\u7ed3\u679c<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&amp;a = 0x7ffc1838d1a0<br>a = 0x7ffc1838d1a0<br>p[0] = 0x7ffc1838d1a0<br>p[1] = 0x7ffc1838d1ac<br>&amp;a[0][0] = 0x7ffc1838d1a0<br>&amp;a[0][1] = 0x7ffc1838d1a4<br>&amp;a[0][2] = 0x7ffc1838d1a8<br>&amp;a[1][0] = 0x7ffc1838d1ac<br>&amp;a[1][1] = 0x7ffc1838d1b0<br>&amp;a[1][2] = 0x7ffc1838d1b4<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u4ed4\u7ec6\u5206\u6790\u4e00\u4e0b\u8fd9\u4e2a\u6570\u7ec4a\uff0c<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&amp;a[0][0] = 0x7ffc1838d1a0<br>&amp;a[0][1] = 0x7ffc1838d1a4<br>&amp;a[0][2] = 0x7ffc1838d1a8<br>&amp;a[1][0] = 0x7ffc1838d1ac<br>&amp;a[1][1] = 0x7ffc1838d1b0<br>&amp;a[1][2] = 0x7ffc1838d1b4<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u5b83\u4eec\u7684\u5730\u5740\u5168\u90e8\u90fd\u662f\u8fde\u7eed\u7684\uff0c\u90a3\u5c31\u8bc1\u660e\u4e8c\u7ef4\u6570\u7ec4\u5728\u5185\u5b58\u4e2d\u662f\u6309\u7167\u7ebf\u6027\u5b58\u50a8\u7684\uff0c\u7136\u540e\u6211\u4eec\u53c8\u80fd\u770b\u5230p[0]\u4e2d\u5b58\u653e\u7684\u662f\u7b2c\u4e00\u884c\u7684\u5730\u5740\uff0cp[1]\u5b58\u653e\u7684\u662f\u7b2c\u4e8c\u884c\u7684\u5730\u5740\uff0c\u6211\u4eec\u6c47\u603b\u4e00\u4e0b\u5c31\u5f97\u51fa\u4ee5\u4e0b\u4e00\u4e2a\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/blog.chxzking.cn\/wp-content\/uploads\/2023\/11\/9GQ@FNC7SSNN6O8DNAAC-1024x388.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"388\" data-original=\"http:\/\/blog.chxzking.cn\/wp-content\/uploads\/2023\/11\/9GQ@FNC7SSNN6O8DNAAC-1024x388.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-111\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u8fd9\u91cc\u6211\u4eec\u5f88\u6e05\u6670\u7684\u770b\u5230\uff0c\u6211\u4eec\u5c06<code>a[2][3]<\/code>\u89e3\u6790\u6210\u4e86\u4e24\u90e8\u5206\uff0c\u9996\u5148\u662f\u4e00\u4e2a\u4e00\u7ef4\u6570\u7ec4<code>[2]<\/code>,\u8fd9\u4e2a\u6570\u7ec4\u4e2d\u5b58\u653e\u7740\u4e24\u4e2a\u6570\u7ec4\u6307\u9488<code>int(*)[3]<\/code>\uff0c\u6bcf\u4e2a\u6570\u7ec4\u6307\u9488\u6307\u5411\u4e86\u4e00\u4e2a\u5305\u542b\u4e09\u4e2a\u5143\u7d20\u7684\u4e00\u7ef4\u5ea6\u6570\u7ec4<code>int [3]<\/code>;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u7ec8\u5f97\u5230\u7684\u7ed3\u679c\u5c31\u662f\uff0ca[2][3]\u4e2d\u76842\uff0c\u6307\u7684\u662f\u5b58\u653e\u4e86\u4e24\u4e2a\u6307\u9488\uff08\u4e5f\u5c31\u662f\u6570\u7ec4\u6307\u9488\uff09\uff0c\u6bcf\u4e2a\u6307\u9488\u6307\u5411\u4e00\u4e2a\u62e5\u6709\u4e09\u4e2a\u5143\u7d20\u7684\u6570\u7ec4(\u4e5f\u5c31\u662f\u4e00\u884c)\uff0c\u6ce8\u610f\uff0c<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u8fd9\u4e2a\u6307\u9488\u5b58\u653e\u7684\u662f\u4e00\u4e2a\u6570\u7ec4\u7684\u5730\u5740<\/mark>\uff0c\u4e0d\u662f\u6570\u7ec4\u9996\u5143\u7d20\u7684\u5730\u5740\uff0c\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u56fe\u4e0a\u65b9\u7684\u4e24\u4e2a\u65b9\u5757\u5730\u5740\u6b65\u957f\u4e3a12\u7684\u539f\u56e0\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u5176\u4e2d\u6211\u4eec\u4e5f\u5f97\u5230\u4e86\u4e00\u4e2a\u91cd\u8981\u7684\u7ed3\u8bba\uff0c\u4e8c\u7ef4\u6570\u7ec4\u7684\u540d\u5b57\u662f\u7b2c\u4e00\u884c\u6570\u7ec4\u7684\u5730\u5740\uff0c\u800c\u975e\u7b2c\u4e00\u4e2a\u5143\u7d20\u7684\u5730\u5740\uff01<\/mark><\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6240\u4ee5\uff0c\u591a\u7ef4\u6570\u7ec4\u5728\u5185\u5b58\u4e2d\u5448\u7ebf\u6027\uff0c\u5728\u903b\u8f91\u4e0a\u6210\u7a7a\u95f4\u5206\u5e03\uff0c\u591a\u7ef4\u6570\u7ec4\u90fd\u9075\u5faa\u8fd9\u4e00\u4e2a\u6838\u5fc3\uff0c\u6240\u4ee5\u4f60\u4e5f\u53ef\u4ee5\u6309\u7167\u8fd9\u4e2a\u601d\u7ef4\u7406\u89e3\u9ad8\u7ef4\u6570\u7ec4\u3002\u4e0d\u8fc7\u6211\u8fd8\u8981\u8865\u5145\u4e00\u70b9\uff0c\u6211\u63a8\u8350\u4e8c\u7ef4\u6570\u7ec4\u7684\u5199\u6cd5\u662f\u8fd9\u6837\uff0c\u8fd9\u79cd\u5199\u6cd5\u4e0d\u5f71\u54cd\u7f16\u8bd1\uff0c\u4f46\u80fd\u66f4\u52a0\u76f4\u89c2\uff0c\u5bf9\u5f00\u53d1\u8005\u5f88\u53cb\u597d\uff0c\u4e00\u773c\u5c31\u80fd\u770b\u51fa\u884c\u5217\u5206\u5e03\uff0c\u4e5f\u80fd\u76f4\u89c2\u770b\u51fa\u6570\u7ec41\u662f{1\uff0c2\uff0c3}\u6570\u7ec42\u662f{4\uff0c5\uff0c6}<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    int a&#91;2]&#91;3]={\n                {1,2,3},\n                {4,5,6}\n                 };<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u73b0\u5728\u518d\u56de\u6765\u770b\u6587\u7ae0\u6700\u9876\u90e8\u7684\u7b2c\u4e00\u4e2a\u4f8b\u5b50\u5e94\u8be5\u5c31\u5f88\u597d\u7406\u89e3\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u63a2\u8ba8\u4e00\u4e0b\u7528\u6307\u9488\u8bbf\u95ee\u4e8c\u7ef4\u6570\u7ec4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\nint main(){\n   int a&#91;2]&#91;3]={\n    {1,2,3},\n    {4,5,6},\n   };\n   int(*p)&#91;3] = a;\n   for(int i=0;i&lt;2;i++){\n    for(int j=0;j&lt;3;j++){\n        printf(\"%d \",*(*(p+i)+j));\n    }\n    printf(\"\\n\");\n   }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">\u8fd0\u884c\u7ed3\u679c<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">1 2 3<br>4 5 6<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u91c7\u7528\u6570\u7ec4\u6307\u9488\u6765\u8bbf\u95ee\u4e8c\u7ef4\u6570\u7ec4\uff0c\u9488\u5bf9\u8fd9\u4e2a\u8868\u8fbe\u5f0f\uff0c\u6211\u4eec\u6765\u5206\u6790\u4e00\u4e0b<code>*(*(p+i)+j) <\/code>\uff0c\u9996\u5148\u662f<code>*(p+i) <\/code>,\u8fd9\u91cc\u6709\u4e00\u70b9\u9700\u8981\u8865\u5145\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\"><code>*(p+1)<\/code>\u5355\u72ec\u4f7f\u7528\u65f6\u8868\u793a\u7684\u662f\u7b2c 1 \u884c\u6570\u636e\uff0c\u653e\u5728\u8868\u8fbe\u5f0f\u4e2d\u4f1a\u88ab\u8f6c\u6362\u4e3a\u7b2c 1 \u884c\u6570\u636e\u7684\u9996\u5730\u5740\uff0c\u4e5f\u5c31\u662f\u7b2c 1 \u884c\u7b2c 0 \u4e2a\u5143\u7d20\u7684\u5730\u5740\uff0c\u56e0\u4e3a\u4f7f\u7528\u6574\u884c\u6570\u636e\u6ca1\u6709\u5b9e\u9645\u7684\u542b\u4e49\uff0c\u7f16\u8bd1\u5668\u9047\u5230\u8fd9\u79cd\u60c5\u51b5\u90fd\u4f1a\u8f6c\u6362\u4e3a\u6307\u5411\u8be5\u884c\u7b2c 0 \u4e2a\u5143\u7d20\u7684\u6307\u9488\uff1b\u5c31\u50cf\u4e00\u7ef4\u6570\u7ec4\u7684\u540d\u5b57\uff0c\u5728\u5b9a\u4e49\u65f6\u6216\u8005\u548c<code> sizeof<\/code>\u3001&amp; \u4e00\u8d77\u4f7f\u7528\u65f6\u624d\u8868\u793a\u6574\u4e2a\u6570\u7ec4\uff0c\u51fa\u73b0\u5728\u8868\u8fbe\u5f0f\u4e2d\u5c31\u4f1a\u88ab\u8f6c\u6362\u4e3a\u6307\u5411\u6570\u7ec4\u7b2c 0 \u4e2a\u5143\u7d20\u7684\u6307\u9488\u3002<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6240\u4ee5\u5728i\u4e3a0\u7684\u65f6\u5019\uff0c\u6211\u4eec\u77e5\u9053p\u662f\u6307\u7b2c\u4e00\u884c\u7684\u9996\u5730\u5740\uff0c\u5982\u679cj\u4e3a1\uff0c\u90a3(*(p+0)+1)\u5c31\u662f\u7b2c1\u884c\u7b2c2\u4e2a\u5143\u7d20\u7684\u5730\u5740\uff0c\u518d\u53d6\u5f15\u7528<code>*(*(p+0)+1)<\/code>\u5c31\u662f\u7b2c\u4e00\u884c\u7b2c\u4e00\u5217\u7684\u503c\uff0c\u540c\u7406*(p+1)\u5c31\u662f\u7b2c\u4e8c\u884c\uff0c*(*(p+1)+1)\u5c31\u662f\u7b2c\u4e8c\u884c\u7b2c\u4e8c\u5217\u7684\u503c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8865\u5145<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u8bf7\u8bfb\u8005\u770b\u4e00\u4e0b\u8fd9\u6bb5\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\nvoid fun(int a&#91;]){\n    int len = sizeof(a);\n    printf(\"fun\u51fd\u6570\u4e2d\u7684len\u7684\u503c\u4e3a%d\\n\",len);\n}\n\nint main(){\n    int a&#91;3]={1,10,100};\n    int len = sizeof(a);\n    printf(\"main\u51fd\u6570\u4e2d\u7684len\u7684\u503c\u4e3a%d\\n\",len);\n    fun(a);\n\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u662f\u521d\u5b66\u8005\u751a\u81f3\u662f\u5927\u795e\u90fd\u53ef\u80fd\u51fa\u73b0\u7684\u9519\u8bef\uff0c\u5728\u6211\u4eec\u7684\u9884\u671f\u4e2d\uff0c\u4e0d\u7ba1\u662ffun\u51fd\u6570\u8fd8\u662fmain\u51fd\u6570\u90fd\u5e94\u8be5\u8f93\u51fa12\uff0c\u4e0d\u8fc7\u8ba9\u6211\u4eec\u6765\u770b\u4e00\u770b\u6700\u7ec8\u7684\u7ed3\u679c\u5427\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">\u8fd0\u884c\u7ed3\u679c<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">main\u51fd\u6570\u4e2d\u7684len\u7684\u503c\u4e3a12<br>fun\u51fd\u6570\u4e2d\u7684len\u7684\u503c\u4e3a8<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u662f\u4e0d\u662f\u611f\u5230\u5f88\u4e0d\u53ef\u601d\u8bae\uff0c\u63a5\u4e0b\u6765\u8ba9\u6211\u8bb2\u89e3\u4e00\u4e0b\uff0c<code>fun(a)<\/code>\u4e2d\u5176\u5b9e\u4f20\u9012\u8fc7\u53bb\u7684\u662fa\u9996\u5143\u7d20\u5730\u5740\uff0c<code>fun(int a[])<\/code>\u627f\u63a5\u7684\u4e5f\u662f\u4e00\u4e2a\u9996\u5143\u7d20\u7684\u5730\u5740\uff0c\u8fd9\u65f6\u7684<code>sizeof<\/code>\u8f93\u51fa\u7684\u662f\u6307\u9488\u6240\u5360\u7684\u7a7a\u95f4\uff0c\u5f53\u7136\u8fd9\u4e2a\u548c\u4f60\u4f7f\u7528\u7684\u7535\u8111\u7cfb\u7edf\u548c\u7f16\u8bd1\u5668\u6709\u5173\uff0c\u4f5c\u8005\u4f7f\u7528\u7684\u662f<code>Linux<\/code>\u7cfb\u7edf\u548c<code>gcc 9.3.1<\/code>\uff0c\u6240\u4ee5\u6211\u4eec\u7684fun\u8f93\u51fa\u7684\u503c\u53ef\u80fd\u6709\u6240\u4e0d\u540c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u6211\u4eec\u5e0c\u671b\u5728<code>fun<\/code>\u51fd\u6570\u4e2d\u9700\u8981\u7528\u5230\u6570\u7ec4\u7684\u957f\u5ea6\u8be5\u600e\u4e48\u529e\uff0c\u5176\u5b9e\u8fd9\u5e76\u6ca1\u6709\u4ec0\u4e48\u597d\u7684\u65b9\u6cd5\uff0c\u4f5c\u8005\u7684\u5efa\u8bae\u662f\u5c06<code>fun<\/code>\u51fd\u6570\u91cd\u5199\uff0c\u6bd4\u5982\u6539\u6210<code>fun(int a[],int len)<\/code>\u957f\u5ea6\u5728\u4e3b\u51fd\u6570\u4e2d\u5c31\u4f20\u8fc7\u6765\uff0c\u8fd9\u79cd\u65b9\u6cd5\u7b80\u6d01\u4e14\u4e0d\u6613\u51fa\u9519\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u7b26\u4e32\u7684\u9690\u5f0f\u4e0e\u663e\u5f0f\u8d4b\u503c<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u663e\u5f0f\u8d4b\u503c\u4e2d\uff0c\u6bd4\u5982<code>char a[2] = {'a','b'};<\/code>\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u7f16\u8bd1\u5668\u662f\u4e0d\u4f1a\u5728\u6570\u7ec4\u672b\u5c3e\u81ea\u52a8\u6dfb\u52a0<code>'\\0'<\/code>\u7684\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u9690\u5f0f\u8d4b\u503c\u4e2d\uff0c\u6bd4\u5982<code>char* a=\"ab\";<\/code>\u548c<code>char a[]=\"ab\";<\/code>\u4e2d\uff0c\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u7f16\u8bd1\u5668\u4f1a\u4e3b\u52a8\u5728\u5b57\u7b26\u4e32\u672b\u5c3e\u6dfb\u52a0<code>'\\0'<\/code>\u6765\u4f5c\u4e3a\u5b57\u7b26\u4e32\u7ed3\u675f\u7b26\u53f7\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0d\u8fc7\u6709\u4e00\u70b9\u8981\u6ce8\u610f\uff0c\u90a3\u5c31\u662f\u5fc5\u987b\u8981\u4fdd\u8bc1\u6709\u8db3\u591f\u7684\u7a7a\u95f4\uff0c\u6bd4\u5982<code>char a[5] = \"abcde\";<\/code>\u7531\u4e8e\u5206\u914d\u7a7a\u95f4\u4e0d\u8db3\u7684\u539f\u56e0\u4f1a\u5bfc\u81f4\u8fd9\u4e2a\u6570\u7ec4\u5373\u4fbf\u662f\u9690\u5f0f\u8d4b\u503c\u7684\u64cd\u4f5c\uff0c\u7f16\u8bd1\u5668\u4e5f\u4e0d\u4f1a\u81ea\u52a8\u52a0\u4e0a<code>'\\0'<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5bf9\u4e8e\u591a\u7ef4\u6570\u7ec4\u6765\u8bf4\u4e5f\u7b26\u5408\u8fd9\u4e2a\u539f\u5219\uff0c<code>char a[3][3] = {'a','b','c','d','e','f','g','h','i'};<\/code>\u5c5e\u4e8e\u663e\u5f0f\u8d4b\u503c\uff0c\u4e0d\u4f1a\u81ea\u52a8\u6dfb\u52a0<code>'\\0'<\/code>\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f46\u662f<code>char a[3][3]={\"abc\",\"def\",\"ghi\"};<\/code>\u9690\u5f0f\u8d4b\u503c\u56e0\u4e3a\u7a7a\u95f4\u4e0d\u8db3\u7684\u539f\u56e0\u4e5f\u4e0d\u4f1a\u81ea\u52a8\u8865\u5145<code>'\\0'<\/code>\uff0c\u4f46\u662f\u5982\u679c\u662f<code>char a[3][4]={\"abc\",\"def\",\"ghi\"};<\/code>\u7f16\u8bd1\u5668\u4f1a\u4e3a\u6bcf\u4e00\u884c\u672b\u5c3e\u90fd\u6dfb\u52a0\u4e00\u4e2a<code>'\\0'<\/code>\uff0c\u5373\u8fd9\u4e2aa\u6570\u7ec4\u4e2d\u4f1a\u5b58\u57283\u4e2a<code>'\\0'<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0d\u8fc7\u8fd9\u4e2a\u968f\u7740\u5e73\u53f0\u548c\u7f16\u8bd1\u5668\u7684\u5dee\u522b\u53ef\u80fd\u51fa\u73b0\u4e0d\u540c\u7684\u7ed3\u679c\uff0c\u6bd4\u5982\u5728vs2019\u4e2d\uff0c\u7f16\u8bd1\u5668\u4f1a\u5728<code>char a[3][3]={\"abc\",\"def\",\"ghi\"};<\/code> \u62a5\u9519\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>\u53c2\u8003\u94fe\u63a5\uff1a<a href=\"https:\/\/c.biancheng.net\/view\/2022.html\">C\u8bed\u8a00\u4e2d\u6587\u7f51<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6570\u7ec4\u662f\u4ec0\u4e48\uff1f \u4ece\u672c\u8d28\u4e0a\u6765\u8bb2\uff0c\u6570\u7ec4\u662f\u4e00\u4e2a\u76f8\u540c\u7c7b\u578b\u7684\u6570\u636e\u96c6\u5408\uff0c\u5982 int a[10] \u672c\u8d28\u4e0a\u662f10\u4e2a int \u7c7b\u578b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":761,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[17,18,22,24],"class_list":["post-100","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c-c","tag-c-2","tag-c","tag-pointer","tag-array"],"_links":{"self":[{"href":"http:\/\/blog.chxzking.cn\/index.php\/wp-json\/wp\/v2\/posts\/100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.chxzking.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.chxzking.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.chxzking.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.chxzking.cn\/index.php\/wp-json\/wp\/v2\/comments?post=100"}],"version-history":[{"count":3,"href":"http:\/\/blog.chxzking.cn\/index.php\/wp-json\/wp\/v2\/posts\/100\/revisions"}],"predecessor-version":[{"id":371,"href":"http:\/\/blog.chxzking.cn\/index.php\/wp-json\/wp\/v2\/posts\/100\/revisions\/371"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/blog.chxzking.cn\/index.php\/wp-json\/wp\/v2\/media\/761"}],"wp:attachment":[{"href":"http:\/\/blog.chxzking.cn\/index.php\/wp-json\/wp\/v2\/media?parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.chxzking.cn\/index.php\/wp-json\/wp\/v2\/categories?post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.chxzking.cn\/index.php\/wp-json\/wp\/v2\/tags?post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}