{"rsdb":{"rid":"156005","subhead":"","postdate":"0","aid":"117111","fid":"54","uid":"1","topic":"1","content":"

\u89c2\u5bdf\u5982\u4e0b\u4e24\u4e2a\u7a0b\u5e8fa.c<\/span>\u548c<\/span>b.c<\/span>\uff1a<\/span><\/p>

A.c\uff1a<\/span><\/p>

\"\"<\/p>

B.c\uff1a<\/span><\/p>

\"\"<\/p>

<\/p>

\u8fd9\u4e24\u4e2a\u7a0b\u5e8f\u90fd\u662f\u8981\u5b9e\u73b0\u5728\u5c4f\u5e55\u4e0a\u7b2c10<\/span>\u884c<\/span>40<\/span>\u5217\u6253\u5370\u4e00\u4e2a\u7eff\u8272\u7684\u5b57\u7b26<\/span>c<\/span>\uff1a<\/span><\/p>

\"\"<\/p>

\u8fd9\u4e24\u4e2a\u7a0b\u5e8f\u7684\u6570\u636e\u7ec4\u7ec7\u65b9\u5f0f\u662f\u4e00\u6837\u7684\uff0c\u90fd\u662f\u4f7f\u7528\u7ed3\u6784\u4f53\uff0c\u800c\u4e14\u5bf9\u5171\u6027\u548c\u4e2a\u6027\u7684\u5206\u79bb\u7684\u601d\u8def\u4e5f\u662f\u4e00\u6837\u7684\uff0c\u90fd\u662f\u5c06\u5171\u6027\u5c01\u88c5\u5728main<\/span>\u51fd\u6570\u91cc\uff0c\u5c06\u4e2a\u6027\u5b9e\u73b0\u5728\u5b50\u51fd\u6570\u91cc\u3002\u4f46\u662f<\/span>a.c<\/span>\u548c<\/span>b.c<\/span>\u5c01\u88c5\u548c\u5206\u79bb\u7684\u89d2\u5ea6\u662f\u4e0d\u4e00\u6837\u7684\uff0c<\/span>a.c<\/span>\u6ca1\u6709\u5c06\u5b57\u7b26\u548c\u989c\u8272\u7684\u5c5e\u6027\u8d4b\u503c\u5206\u79bb\u51fa\u6765\uff0c\u800c\u53ea\u662f\u5c06\u663e\u793a\u529f\u80fd\u5206\u79bb\u51fa\u6765\uff0c<\/span>b.c<\/span>\u5c06\u5b57\u7b26\u3001\u989c\u8272\u7684\u8d4b\u503c\u548c\u663e\u793a\u529f\u80fd\u90fd\u5206\u79bb\u4e86\u51fa\u6765\uff0c\u7528\u4e09\u4e2a\u5b50\u51fd\u6570\u5b9e\u73b0\uff0c\u5e76\u5c06\u76f8\u5bf9\u5e94\u7684\u51fd\u6570\u6307\u9488\u5c01\u88c5\u5230\u7ed3\u6784\u4f53\u91cc\u53bb\u3002\u9762\u5411\u5bf9\u8c61\u7a0b\u5e8f\u8bbe\u8ba1\u7684\u4e00\u6761\u57fa\u672c\u539f\u5219\u662f<\/span>\u8ba1\u7b97\u673a\u7a0b\u5e8f\u662f\u7531\u5355\u4e2a\u80fd\u591f\u8d77\u5230\u5b50\u7a0b\u5e8f\u4f5c\u7528\u7684\u5355\u5143\u6216\u5bf9\u8c61\u7ec4\u5408\u800c\u6210\uff0c\u4e5f\u5c31\u662f\u8bf4\u6211\u4eec\u8981\u5c3d\u91cf\u628a\u529f\u80fd\u4ee5\u5b50\u51fd\u6570\u7684\u5f62\u5f0f\u5b9e\u73b0\u3002\u6240\u4ee5\u5728\u8fd9\u91cc\u867d\u7136a<\/span>\u548c<\/span>b<\/span>\u7684\u8bbe\u8ba1\u601d\u60f3\u662f\u76f8\u540c\u7684\uff0c\u4f46\u662f<\/span>b.c<\/span>\u7684\u5c01\u88c5\u6027\u8981\u6bd4<\/span>a.c<\/span>\u7684\u5c01\u88c5\u6027\u66f4\u597d\u3002<\/span><\/p>

\u518d\u6765\u770b\u4e0b\u4e00\u4e2a\u7a0b\u5e8f\uff1a<\/p>

\"\"<\/p>

\u73b0\u5728\u8981\u5728\uff1f\u5904\u6dfb\u52a0\u8bed\u53e5\uff0c\u4f7f\u7a0b\u5e8f\u80fd\u591f\u5b9e\u73b0\u529f\u80fd\u3002<\/p>

\u8fd9\u91ccch*a=new<\/span>\uff08<\/span>ch<\/span>\uff09\uff1b\u7684\u529f\u80fd\u5e94\u8be5\u4e0e<\/span>cha<\/span>\uff1b\u76f8\u540c\uff0c\u5373\u5b9a\u4e49\u4e00\u4e2a<\/span>structc<\/span>\u578b\u7684\u7ed3\u6784\u4f53\u53d8\u91cf<\/span>a<\/span>\u3002\u4f46\u662f\u6211\u4eec\u7528<\/span>cha<\/span>\uff1b\u662f\u5f00\u8f9f\u4e86\u4e00\u4e2a<\/span>ch<\/span>\u5927\u5c0f\u7684\u7a7a\u95f4\u5e76\u628a\u5b83\u547d\u540d\u4e3a<\/span>a<\/span>\uff0c\u800c\u8fd9\u91cc<\/span>ch*a=<\/span>\uff1f\u53ea\u662f\u5bf9\u4e00\u4e2a\u6307\u9488\u8fdb\u884c\u4e86\u8d4b\u503c\uff0c\u6211\u4eec\u4e00\u822c\u5bf9\u6307\u9488\u8d4b\u503c\u53ea\u662f\u628a\u4e00\u4e2a\u5730\u5740\u7ed9\u5b83\uff0c\u5e76\u6ca1\u6709\u5f00\u8f9f\u7a7a\u95f4\uff0c\u4f46\u662f\u6211\u4eec\u8981\u5b9e\u73b0<\/span>cha<\/span>\uff1b\u7684\u529f\u80fd\uff0c\u5fc5\u987b\u8981\u5728\u8fd9\u4e00\u53e5\u91cc\u5bf9\u8be5\u5730\u5740\u5f00\u8f9f\u7a7a\u95f4\u3002\u73b0\u5728\u7684\u95ee\u9898\u5c31\u662f\uff1a\u600e\u4e48\u5728\u7ed9\u6307\u9488\u8d4b\u503c\u65f6\u5f00\u8f9f\u5185\u5b58\u7a7a\u95f4\uff1f<\/span><\/p>

\u6211\u4eec\u77e5\u9053\u6570\u7ec4\u5728\u5b9a\u4e49\u65f6\u53ef\u4ee5\u5f00\u8f9f\u7a7a\u95f4\uff0c\u4f46\u662f\u6570\u7ec4\u5b9a\u4e49\u9700\u8981\u5355\u72ec\u7684\u4e00\u53e5\uff0c\u800c\u8fd9\u91cc\u9700\u8981\u76f4\u63a5\u4f5c\u4e3a\u53f3\u503c\u4f7f\u7528\uff0c\u6240\u4ee5\u8fd9\u91cc\u9700\u8981\u52a8\u6001\u5730\u5f00\u8f9f\u7a7a\u95f4\u3002\u6211\u4eec\u6700\u5e38\u7528\u7684\u52a8\u6001\u5185\u5b58\u5206\u914d\u65b9\u6cd5\u5c31\u662f\u4f7f\u7528malloc<\/span>\u51fd\u6570\uff0c\u8fd9\u4e2a\u51fd\u6570\u6709\u4e00\u4e2a\u53c2\u6570\uff0c\u662f\u8981\u5f00\u8f9f\u7684\u7a7a\u95f4\u5b57\u8282\u6570\uff0c\u5728\u8fd9\u91cc\u6211\u4eec\u8981\u5f00\u8f9f\u7684\u7a7a\u95f4\u5927\u5c0f\u662f\u7ed3\u6784\u4f53<\/span>a<\/span>\u7684\u5927\u5c0f\uff0c\u4f46\u662f\u6211\u4eec\u4e0d\u77e5\u9053\u7ed3\u6784\u4f53<\/span>a<\/span>\u7684\u5927\u5c0f\uff0c\u6240\u4ee5\u6211\u4eec\u8981\u7528<\/span>sizeof<\/span>\u5f97\u51fa\u5b83\u7684\u5927\u5c0f\u3002\u7528<\/span>malloc<\/span>\u5f00\u8f9f\u7a7a\u95f4\u540e\u518d\u5c06\u5176\u8f6c\u6362\u6210\u7ed3\u6784\u4f53\u6307\u9488\u8d4b\u7ed9<\/span>a<\/span>\uff0c\u7a0b\u5e8f\u5982\u4e0b\uff1a<\/span><\/p>

\"\"<\/p>

\u6211\u4eec\u4e4b\u524d\u4f7f\u7528\u8fc7\u5b8f\u5b9a\u4e49\uff0c\u4f46\u662f\u5728\u7a0b\u5e8f\u4e2d\u662f\u5b8f\u540d\u76f4\u63a5\u66ff\u6362\u6389\u540e\u9762\u7684\u4e1c\u897f\u7684\uff0c\u800c\u8fd9\u91cc\u5b8f\u6709\u53c2\u6570x<\/span>\uff0c\u6240\u4ee5\u5b83\u662f\u5e26\u53c2\u5b8f\u5b9a\u4e49\uff0c\u5b83\u7684\u683c\u5f0f\u4e3a\uff1a<\/span>#define\u5b8f\u540d<\/span>(<\/span>\u5f62\u53c2\u8868)<\/span>\u5b57\u7b26\u4e32<\/span>\u3002\u8fd9\u91cc\u7684x<\/span>\u5c31\u662f\u4e00\u4e2a\u5f62\u53c2\u3002\u6240\u4ee5\u6211\u4eec\u8981\u5728\u4f7f\u7528\u65f6\u5728\u5b8f\u540d\u540e\u9762\u4f20\u5165\u5b9e\u53c2\u3002<\/span><\/p>

\u8fd9\u91cc\u7684\u5b8f\u540d\u662fnew<\/span>\uff0c\u5b66\u8fc7<\/span>java<\/span>\u6211\u4eec\u4f1a\u53d1\u73b0<\/span>java<\/span>\u91cc\u521d\u59cb\u5316\u5bf9\u8c61\u4e5f\u662f\u4f7f\u7528<\/span>new<\/span>\uff0c\u8fd9\u91cc\u7684<\/span>new<\/span>\u5176\u5b9e\u4e5f\u662f\u5b9e\u73b0\u4e00\u4e2a\u76f8\u4f3c\u7684\u529f\u80fd\u3002\u6211\u4eec\u53ef\u4ee5\u628a\u7ed3\u6784\u4f53<\/span>ch<\/span>\u7406\u89e3\u6210\u4e00\u4e2a\u7c7b\uff0c\u7528<\/span>new<\/span>\u5bf9\u5b83\u8fdb\u884c\u5b9e\u4f8b\u5316\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u5b9e\u73b0\u9762\u5411\u5bf9\u8c61\u7684\u7a0b\u5e8f\u8bbe\u8ba1\u601d\u60f3\u3002\u5176\u5b9e<\/span>java<\/span>\u91cc\u5b9e\u4f8b\u5316\u5bf9\u8c61\u4e5f\u662f\u5f00\u8f9f\u4e00\u4e2a\u5185\u5b58\u7a7a\u95f4\u5e76\u7ed9\u8fd9\u4e2a\u7a7a\u95f4\u53d6\u4e00\u4e2a\u540d\u5b57\u5373\u5bf9\u8c61\u540d\u3002\u7ed3\u6784\u4f53\u4e3a\u4ec0\u4e48\u53ef\u4ee5\u5b9e\u73b0\u7c7b\u7684\u529f\u80fd\u5462\uff1f\u6211\u4eec\u77e5\u9053\uff0c\u7c7b\u91cc\u9762\u53ef\u4ee5\u5b9a\u4e49\u53d8\u91cf\u3001\u6570\u7ec4\u3001\u51fd\u6570\uff0c\u5e76\u8fdb\u884c\u4e00\u4e9b\u64cd\u4f5c\u5982\u8d4b\u503c\u3001\u8c03\u7528\u51fd\u6570\u4e4b\u7c7b\u7684\uff0c\u53ea\u662f\u5728<\/span>java<\/span>\u4e2d\u7c7b\u91cc\u9762\u7a0b\u5e8f\u5458\u4e0d\u80fd\u5b9a\u4e49\u548c\u4f7f\u7528\u6307\u9488\u8fdb\u884c\u64cd\u4f5c\u3002\u800c\u7ed3\u6784\u4f53\u91cc\u9762\u4e5f\u53ef\u4ee5\u8fdb\u884c\u5b9a\u4e49\u53d8\u91cf\u3001\u6570\u7ec4\u3001\u51fd\u6570\u6307\u9488\u7b49\u7684\u64cd\u4f5c\uff0c\u6240\u4ee5\u5982\u679c\u6211\u4eec\u8981\u7528<\/span>c<\/span>\u8bed\u8a00\u7f16\u5199\u5177\u6709\u9762\u5411\u5bf9\u8c61\u601d\u60f3\u7684\u7a0b\u5e8f\uff0c\u6211\u4eec\u53ef\u4ee5\u7528\u7ed3\u6784\u4f53\u6765\u5b9e\u73b0\u7c7b\u4f3c\u201c\u7c7b\u201d\u7684\u529f\u80fd\uff0c\u5e76\u7528\u5e26\u53c2\u5b8f\u5b9a\u4e49\u6765\u5b9e\u73b0\u5b9e\u4f8b\u5316\u7684\u529f\u80fd\uff0c\u6216\u8005\u53ef\u4ee5\u76f4\u63a5\u7528<\/span>malloc<\/span>\u51fd\u6570\u6765\u5b9e\u73b0\u5b9e\u4f8b\u5316\uff0c\u53ea\u4e0d\u8fc7\u8fd9\u6837\u8bed\u53e5\u6bd4\u8f83\u91cd\u590d\u3002<\/span><\/p>

\u867d\u7136\u6211\u4eec\u53ef\u4ee5\u5728c<\/span>\u8bed\u8a00\u91cc\u9762\u7528\u8fd9\u79cd\u65b9\u6cd5\u5b9e\u73b0\u9762\u5411\u5bf9\u8c61\u7684\u7a0b\u5e8f\u8bbe\u8ba1\uff0c\u4f46\u662f\u8fd9\u6837\u6bd5\u7adf\u4e0d\u5982\u7528<\/span>java<\/span>\u4e4b\u7c7b\u7684\u6bd4\u8f83\u9002\u5408\u9762\u5411\u5bf9\u8c61\u7684\u8bed\u8a00\u6765\u5199\u6709\u9762\u5411\u5bf9\u8c61\u601d\u60f3\u7684\u7a0b\u5e8f\u3002\u56e0\u4e3a<\/span>java<\/span>\u7684\u7c7b\u91cc\u53ef\u4ee5\u8fdb\u884c\u8d4b\u503c\u3001\u8c03\u7528\u51fd\u6570\u7b49\u529f\u80fd\u800c<\/span>c<\/span>\u91cc\u7684\u7ed3\u6784\u4f53\u4e0d\u80fd\u3002<\/span>java<\/span>\u53d6\u6d88\u4e86\u7a0b\u5e8f\u5458\u4f7f\u7528\u6307\u9488\u7684\u6743\u9650\uff0c\u56e0\u4e3a\u5982\u679c\u5728\u8fd9\u79cd\u9ad8\u5ea6\u5c01\u88c5\u7684\u8bed\u8a00\u91cc\u4f7f\u7528\u6307\u9488\u5f88\u53ef\u80fd\u9020\u6210\u5f88\u591a\u9519\u8bef\u3002<\/span><\/p>

\u4ece\u8fd9\u91cc\u770b\uff0c\u9762\u5411\u5bf9\u8c61\u548c\u9762\u5411\u8fc7\u7a0b\u7a0b\u5e8f\u8bbe\u8ba1\u601d\u60f3\u7684\u533a\u522b\u5728\u54ea\u91cc\u5462\uff1f\u9762\u5411\u5bf9\u8c61\u7684\u7a0b\u5e8f\u53ef\u80fd\u9700\u8981\u66f4\u591a\u7684\u5c01\u88c5\uff0c\u5b83\u7684\u6bcf\u4e00\u4e2a\u5bf9\u8c61\u90fd\u662f\u4e3a\u6267\u884c\u7279\u5b9a\u7684\u529f\u80fd\u800c\u5c01\u88c5\u7684\uff0c\u5bf9\u8c61\u4e0e\u5bf9\u8c61\u4e4b\u95f4\u76f8\u5bf9\u6bd4\u8f83\u72ec\u7acb\uff0c\u5173\u7cfb\u6e05\u6670\uff0c\u4fbf\u4e8e\u7a0b\u5e8f\u7684\u529f\u80fd\u7ec6\u5316\u3001\u7ba1\u7406\u7ef4\u62a4\uff0c\u4f46\u662f\u4e5f\u4f1a\u9020\u6210\u7a0b\u5e8f\u7684\u4ee3\u7801\u91cf\u589e\u5927\u3002\u9762\u5411\u8fc7\u7a0b\u7684\u7a0b\u5e8f\u5c01\u88c5\u7684\u4e3b\u8981\u662f\u4e00\u4e9b\u6570\u636e\u7ed3\u6784\uff0c\u4e00\u4e2a\u51fd\u6570\u3001\u53d8\u91cf\u53ef\u4ee5\u88ab\u4ee5\u591a\u79cd\u89d2\u5ea6\u6765\u4f7f\u7528\uff0c\u8fd9\u6837\u4f7f\u7a0b\u5e8f\u53d8\u5f97\u5341\u5206\u7cbe\u7b80\u77ed\u5c0f\uff0c\u4f46\u662f\u4e0d\u5bb9\u6613\u4fee\u6539\u548c\u8865\u5145\u3002<\/p>

\u6211\u4eec\u5199\u7a0b\u5e8f\u662f\u7528\u6765\u89e3\u51b3\u95ee\u9898\u7684\uff0c\u800c\u4e14\u8981\u89e3\u51b3\u7684\u662f\u73b0\u5b9e\u4e2d\u7684\u95ee\u9898\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u5c06\u73b0\u5b9e\u95ee\u9898\u8f6c\u5316\u4e3a\u7b26\u53f7\u5316\u7684\u95ee\u9898\uff0c\u800c\u73b0\u5b9e\u4e2d\u7684\u95ee\u9898\u662f\u7531\u4e2a\u4f53\u6240\u7ec4\u6210\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u5c06\u6570\u636e\u548c\u5904\u7406\u6570\u636e\u7684\u65b9\u6cd5\u5c01\u88c5\u8d77\u6765\u5f62\u6210\u4e00\u4e2a\u4e2a\u4f53\uff0c\u8fd9\u4e2a\u4e2a\u4f53\u5728\u95ee\u9898\u91cc\u9762\u6709\u4e13\u95e8\u7684\u529f\u80fd\uff0c\u6bd4\u5982\u4e00\u5f20\u7eb8\u53ef\u4ee5\u6298\u53e0\uff0c\u4e00\u652f\u7b14\u53ef\u4ee5\u5199\uff0c\u8fd9\u6837\u6709\u52a9\u4e8e\u6211\u4eec\u4ee5\u81ea\u8eab\u7684\u89d2\u5ea6\u8fdb\u884c\u601d\u8003\u5206\u6790\uff0c\u8fd9\u5c31\u662f\u9762\u5411\u5bf9\u8c61\u3002\u5982\u679c\u7528\u9762\u5411\u8fc7\u7a0b\u7684\u601d\u8def\uff0c\u4f1a\u5bfc\u81f4\u95ee\u9898\u4e0e\u7a0b\u5e8f\u4e4b\u95f4\u7684\u8f6c\u5316\u4e0d\u597d\u5904\u7406\uff0c\u53ef\u80fd\u4f7f\u89e3\u51b3\u95ee\u9898\u51fa\u73b0\u504f\u5dee\u3002<\/p>

1\u3001\u52a8\u6001\u5f00\u8f9f\u5185\u5b58\u7a7a\u95f4\u7684\u51fd\u6570\u6709\u54ea\u4e9b\uff1f<\/p>

\u7b54\uff1ac<\/span>\u8bed\u8a00\u6709\u4e09\u4e2a\u51fd\u6570\u53ef\u4ee5\u52a8\u6001\u5f00\u8f9f\u6570\u7ec4\uff1a<\/span>malloc<\/span>\u51fd\u6570\u3001<\/span>calloc<\/span>\u51fd\u6570\u3001<\/span>realloc<\/span>\u51fd\u6570\u3002<\/span><\/p>

c\u8bed\u8a00\u63d0\u4f9b\u4e86<\/span>malloc<\/span>\u51fd\u6570\u548c<\/span>free<\/span>\u51fd\u6570\u7528\u6765\u6267\u884c\u52a8\u6001\u5185\u5b58\u5206\u914d\u548c\u91ca\u653e\uff0c\u8fd9\u4e9b\u51fd\u6570\u7ef4\u62a4\u4e00\u4e2a\u53ef\u7528\u5185\u5b58\u6c60\uff0c<\/span>malloc<\/span>\u51fd\u6570\u53ef\u4ee5\u4ece\u5185\u5b58\u6c60\u4e2d\u63d0\u53d6\u4e00\u5757\u5408\u9002\u7684\u5185\u5b58\uff0c<\/span>free<\/span>\u51fd\u6570\u7528\u6765\u91ca\u653e\u8fd9\u5757\u5185\u5b58\u4ee5\u4f9b\u522b\u7684\u7a0b\u5e8f\u4f7f\u7528\u3002<\/span>Malloc<\/span>\u51fd\u6570\u5206\u914d\u7684\u662f\u4e00\u5757\u8fde\u7eed\u7684\u5185\u5b58\uff0c\u8fd4\u56de\u503c\u662f\u4e00\u4e2a\u6307\u5411\u88ab\u5206\u914d\u7684\u5185\u5b58\u5757\u8d77\u59cb\u4f4d\u7f6e\u7684\u6307\u9488\u3002<\/span>Malloc<\/span>\u5b9e\u9645\u5206\u914d\u7684\u5185\u5b58\u53ef\u80fd\u6bd4\u4f60\u8bf7\u6c42\u7684\u7684\u591a\u4e00\u70b9\uff0c\u4e5f\u53ef\u80fd\u4e0d\u4f1a\uff0c\u8fd9\u662f\u7531\u7f16\u8bd1\u5668\u51b3\u5b9a\u7684\u3002\u4f46\u662f<\/span>malloc<\/span>\u4e5f\u53ef\u80fd\u5206\u914d\u5931\u8d25\uff0c\u5982\u679c\u64cd\u4f5c\u7cfb\u7edf\u65e0\u6cd5\u5411<\/span>malloc<\/span>\u51fd\u6570\u63d0\u4f9b\u8db3\u591f\u7684\u53ef\u7528\u5185\u5b58\uff0c\u90a3\u4e48\u5b83\u4f1a\u8fd4\u56de\u4e00\u4e2a<\/span>NULL<\/span>\u6307\u9488\u3002<\/span>Malloc<\/span>\u8fd4\u56de\u7684\u6307\u9488\u7c7b\u578b\u4e3a<\/span>void*<\/span>\u578b\u3002<\/span>Free<\/span>\u7684\u53c2\u6570\u5fc5\u987b\u8981\u4e48\u662f<\/span>NULL<\/span>\uff0c\u8981\u4e48\u662f<\/span>malloc<\/span>\u51fd\u6570\u3001<\/span>calloc<\/span>\u51fd\u6570\u3001<\/span>realloc<\/span>\u51fd\u6570\u8fd4\u56de\u7684\u503c\u3002<\/span><\/p>

Calloc\u51fd\u6570\u7684\u53c2\u6570\u662f\u6240\u9700\u5143\u7d20\u7684\u6570\u91cf\u548c\u6bcf\u4e2a\u5143\u7d20\u7684\u5b57\u8282\u6570\uff0c\u800c\u4e0d\u662f\u603b\u7684\u5b57\u8282\u6570\u3002<\/span>Calloc<\/span>\u4f1a\u628a\u5206\u914d\u7684\u5185\u5b58\u90fd\u521d\u59cb\u5316\u4e3a<\/span>0<\/span>\uff0c\u800c<\/span>malloc<\/span>\u4e0d\u4f1a\u521d\u59cb\u5316\u3002<\/span><\/p>

Realloc\u51fd\u6570\u7528\u4e8e\u4fee\u6539\u4e00\u4e2a\u539f\u5148\u5df2\u5206\u914d\u7684\u5185\u5b58\u5757\u7684\u5927\u5c0f\uff0c\u5982\u679c\u539f\u5148\u7684\u5185\u5b58\u5757\u5927\u5c0f\u65e0\u6cd5\u6539\u53d8\uff0c\u90a3\u4e48<\/span>realloc<\/span>\u4f1a\u5206\u914d\u53e6\u4e00\u5757\u6b63\u786e\u5927\u5c0f\u7684\u5185\u5b58\uff0c\u5e76\u628a\u539f\u5148\u90a3\u5757\u5185\u5b58\u7684\u5185\u5bb9\u590d\u5236\u5230\u65b0\u7684\u5757\u4e0a\u3002\u5982\u679c<\/span>realloc<\/span>\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u4e3a<\/span>NULL<\/span>\uff0c\u90a3\u4e48\u5b83\u7684\u4f5c\u7528\u548c<\/span>malloc<\/span>\u4e00\u6837\u3002<\/span><\/p>

\u8fd9\u4e00\u7ae0\u91cc\u6211\u4eec\u5b66\u4e60\u4e86\u52a8\u6001\u5206\u914d\u5185\u5b58\u7684\u65b9\u6cd5\uff0c\u4ee5\u53ca\u600e\u4e48\u4f7f\u7528\u5b8f\u5b9a\u4e49\uff0c\u5176\u5b9e\u5b83\u4eec\u90fd\u662f\u4e3a\u4e86\u66f4\u597d\u5730\u8fdb\u884c\u5c01\u88c5\u3002\u4e3a\u4e86\u5bf9\u7a0b\u5e8f\u8fdb\u884c\u66f4\u597d\u5730\u5c01\u88c5\uff0c\u4eba\u4eec\u4f7f\u7528\u4e86\u5404\u79cd\u65b9\u5f0f\uff0c\u751a\u81f3\u5f00\u53d1\u4e86\u5c01\u88c5\u6027\u66f4\u5f3a\u7684\u9ad8\u7ea7\u8bed\u8a00\uff0c\u8fd9\u4f7f\u6211\u4eec\u89e3\u51b3\u4e13\u95e8\u95ee\u9898\u7684\u80fd\u529b\u66f4\u5f3a\u4e86\u3002\u8fd9\u6837\u6211\u4eec\u7f16\u7a0b<\/a>\u53ea\u662f\u5c06\u5171\u6027\u5b9e\u73b0\u4e3a\u4e2a\u6027\u3002\u56e0\u4e3a\u8bed\u8a00\u53ea\u662f\u5de5\u5177\uff0c\u7a0b\u5e8f\u5458\u5e94\u8be5\u66f4\u4e13\u6ce8\u5730\u7814\u7a76\u7b97\u6cd5\u800c\u4e0d\u662f\u628a\u65f6\u95f4\u82b1\u5728\u8bed\u8a00\u4e0a\uff0c\u6240\u4ee5\u73b0\u5728\u7684\u8bed\u8a00\u90fd\u662f\u4e3a\u4e86\u7b80\u5316\u7a0b\u5e8f\u5458\u7684\u5de5\u4f5c\u6240\u9020\u6210\u7684\u3002<\/p>

\u6211\u4eec\u5c01\u88c5\u7684\u8fc7\u7a0b\uff0c\u662f\u5bf9\u4e8b\u7269\u8fdb\u884c\u62bd\u8c61\u7684\u8fc7\u7a0b\uff0c\u4e5f\u662f\u5bf9\u4e8b\u7269\u8fdb\u884c\u8ba4\u8bc6\u7684\u8fc7\u7a0b\uff0c\u6211\u4eec\u4ece\u5f00\u59cb\u5230\u73b0\u5728\uff0c\u5c01\u88c5\u7684\u5c42\u6b21\u8d8a\u6765\u8d8a\u6df1\uff0c\u5904\u7406\u7684\u95ee\u9898\u4e5f\u8d8a\u6765\u8d8a\u590d\u6742\u3002\u56e0\u4e3a\u6211\u4eec\u9700\u8981\u7406\u6e05\u590d\u6742\u95ee\u9898\u7684\u5185\u90e8\u89c4\u5f8b\uff0c\u4ece\u800c\u627e\u51fa\u89e3\u51b3\u95ee\u9898\u7684\u529e\u6cd5\uff0c\u800c\u6df1\u5c42\u6b21\u7684\u5c01\u88c5\u4f7f\u95ee\u9898\u6062\u590d\u6210\u672c\u6765\u7684\u6837\u5b50\u5c31\u662f\u4e00\u79cd\u89e3\u51b3\u529e\u6cd5\uff0c\u5f53\u5c01\u88c5\u7684\u7a0b\u5ea6\u8fbe\u5230\u4e86\u4e00\u5b9a\u7684\u6c34\u5e73\uff0c\u5c31\u662f\u9762\u5411\u5bf9\u8c61\u7684\u7a0b\u5e8f\u8bbe\u8ba1\u601d\u60f3\u3002<\/p>","orderid":"0","title":"C\u8bed\u8a00\u91cc\u7528\u7ed3\u6784\u4f53\u548c\u6307\u9488\u51fd\u6570\u5b9e\u73b0\u9762\u5411\u5bf9\u8c61\u601d\u60f3","smalltitle":"","mid":"0","fname":"linux\u7f16\u7a0b\u57fa\u7840","special_id":"0","bak_id":"0","info":"0","hits":"67","pages":"1","comments":"0","posttime":"2017-01-02 08:15:20","list":"1483316120","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"http:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"\u8bed\u8a00<\/A> \u7ed3\u6784<\/A> \u6307\u9488<\/A> \u51fd\u6570<\/A> \u5b9e\u73b0<\/A> \u9762\u5411<\/A> \u5bf9\u8c61<\/A> \u601d\u60f3<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"14.17.22.31","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"C\u8bed\u8a00\u91cc\u7528\u7ed3\u6784\u4f53\u548c\u6307\u9488\u51fd\u6570\u5b9e\u73b0\u9762\u5411\u5bf9\u8c61\u601d\u60f3","lastview":"1493137715","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}