{"rsdb":{"rid":"155748","subhead":"","postdate":"0","aid":"116927","fid":"45","uid":"1","topic":"1","content":"
\n

\u5728C\u8bed\u8a00<\/a>\u4e2d\uff0c\u4fee\u9970\u7b26extern\u7528\u5728\u53d8\u91cf\u6216\u8005\u51fd\u6570\u7684\u58f0\u660e\u524d\uff0c\u7528\u6765\u8bf4\u660e\u201c\u6b64\u53d8\u91cf\/\u51fd\u6570\u662f\u5728\u522b\u5904\u5b9a\u4e49\u7684\uff0c\u8981\u5728\u6b64\u5904\u5f15\u7528\u201d\u3002<\/strong><\/p> \n

1. extern\u4fee\u9970\u53d8\u91cf\u7684\u58f0\u660e\u3002\u4e3e\u4f8b\u6765\u8bf4\uff0c\u5982\u679c\u6587\u4ef6a.c\u9700\u8981\u5f15\u7528b.c\u4e2d\u53d8\u91cfint v\uff0c\u5c31\u53ef\u4ee5\u5728a.c\u4e2d\u58f0\u660eextern int v\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u5f15\u7528\u53d8\u91cfv\u3002\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u88ab\u5f15\u7528\u7684\u53d8\u91cfv\u7684\u94fe\u63a5\u5c5e\u6027\u5fc5\u987b\u662f\u5916\u94fe\u63a5(external)\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4a.c\u8981\u5f15\u7528\u5230v\uff0c\u4e0d\u53ea\u662f\u53d6\u51b3\u4e8e\u5728a.c\u4e2d\u58f0\u660eextern int v\uff0c\u8fd8\u53d6\u51b3\u4e8e\u53d8\u91cfv\u672c\u8eab\u662f\u80fd\u591f\u88ab\u5f15\u7528\u5230\u7684\u3002\u8fd9\u6d89\u53ca\u5230c\u8bed\u8a00<\/a>\u7684\u53e6\u5916\u4e00\u4e2a\u8bdd\u9898--\u53d8\u91cf\u7684\u4f5c\u7528\u57df\u3002\u80fd\u591f\u88ab\u5176\u4ed6\u6a21\u5757\u4ee5extern\u4fee\u9970\u7b26\u5f15\u7528\u5230\u7684\u53d8\u91cf\u901a\u5e38\u662f\u5168\u5c40\u53d8\u91cf\u3002\u8fd8\u6709\u5f88\u91cd\u8981\u7684\u4e00\u70b9\u662f\uff0cextern int v\u53ef\u4ee5\u653e\u5728a.c\u4e2d\u7684\u4efb\u4f55\u5730\u65b9\uff0c\u6bd4\u5982\u4f60\u53ef\u4ee5\u5728a.c\u4e2d\u7684\u51fd\u6570fun\u5b9a\u4e49\u7684\u5f00\u5934\u5904\u58f0\u660eextern int v\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u5f15\u7528\u5230\u53d8\u91cfv\u4e86\uff0c\u53ea\u4e0d\u8fc7\u8fd9\u6837\u53ea\u80fd\u5728\u51fd\u6570fun\u4f5c\u7528\u57df\u4e2d\u5f15\u7528v\u7f62\u4e86\uff0c\u8fd9\u8fd8\u662f\u53d8\u91cf\u4f5c\u7528\u57df\u7684\u95ee\u9898\u3002\u5bf9\u4e8e\u8fd9\u4e00\u70b9\u6765\u8bf4\uff0c\u5f88\u591a\u4eba\u4f7f\u7528\u7684\u65f6\u5019\u90fd\u5fc3\u5b58\u987e\u8651\u3002\u597d\u50cfextern\u58f0\u660e\u53ea\u80fd\u7528\u4e8e\u6587\u4ef6\u4f5c\u7528\u57df\u4f3c\u7684\u3002<\/p> \n

2. extern\u4fee\u9970\u51fd\u6570\u58f0\u660e\u3002\u4ece\u672c\u8d28\u4e0a\u6765\u8bb2\uff0c\u53d8\u91cf\u548c\u51fd\u6570\u6ca1\u6709\u533a\u522b\u3002\u51fd\u6570\u540d\u662f\u6307\u5411\u51fd\u6570\u4e8c\u8fdb\u5236\u5757\u5f00\u5934\u5904\u7684\u6307\u9488\u3002\u5982\u679c\u6587\u4ef6a.c\u9700\u8981\u5f15\u7528b.c\u4e2d\u7684\u51fd\u6570\uff0c\u6bd4\u5982\u5728b.c\u4e2d\u539f\u578b\u662fint fun(int mu)\uff0c\u90a3\u4e48\u5c31\u53ef\u4ee5\u5728a.c\u4e2d\u58f0\u660eextern int fun(int mu)\uff0c\u7136\u540e\u5c31\u80fd\u4f7f\u7528fun\u6765\u505a\u4efb\u4f55\u4e8b\u60c5\u3002\u5c31\u50cf\u53d8\u91cf\u7684\u58f0\u660e\u4e00\u6837\uff0cextern int fun(int mu)\u53ef\u4ee5\u653e\u5728a.c\u4e2d\u4efb\u4f55\u5730\u65b9\uff0c\u800c\u4e0d\u4e00\u5b9a\u975e\u8981\u653e\u5728a.c\u7684\u6587\u4ef6\u4f5c\u7528\u57df\u7684\u8303\u56f4\u4e2d\u3002\u5bf9\u5176\u4ed6\u6a21\u5757\u4e2d\u51fd\u6570\u7684\u5f15\u7528\uff0c\u6700\u5e38\u7528\u7684\u65b9\u6cd5\u662f\u5305\u542b\u8fd9\u4e9b\u51fd\u6570\u58f0\u660e\u7684\u5934\u6587\u4ef6\u3002\u4f7f\u7528extern\u548c\u5305\u542b\u5934\u6587\u4ef6\u6765\u5f15\u7528\u51fd\u6570\u6709\u4ec0\u4e48\u533a\u522b\u5462extern\u7684\u5f15\u7528\u65b9\u5f0f\u6bd4\u5305\u542b\u5934\u6587\u4ef6\u8981\u7b80\u6d01\u5f97\u591a!extern\u7684\u4f7f\u7528\u65b9\u6cd5\u662f\u76f4\u63a5\u4e86\u5f53\u7684\uff0c\u60f3\u5f15\u7528\u54ea\u4e2a\u51fd\u6570\u5c31\u7528extern\u58f0\u660e\u54ea\u4e2a\u51fd\u6570\u3002\u8fd9\u5927\u6982\u662fKISS\u539f\u5219\u7684\u4e00\u79cd\u4f53\u73b0\u5427!\u8fd9\u6837\u505a\u7684\u4e00\u4e2a\u660e\u663e\u7684\u597d\u5904\u662f\uff0c\u4f1a\u52a0\u901f\u7a0b\u5e8f\u7684\u7f16\u8bd1(\u786e\u5207\u7684\u8bf4\u662f\u9884\u5904\u7406)\u7684\u8fc7\u7a0b\uff0c\u8282\u7701\u65f6\u95f4\u3002\u5728\u5927\u578bC\u7a0b\u5e8f\u7f16\u8bd1\u8fc7\u7a0b\u4e2d\uff0c\u8fd9\u79cd\u5dee\u5f02\u662f\u975e\u5e38\u660e\u663e\u7684\u3002<\/p> \n

3. \u6b64\u5916\uff0cextern\u4fee\u9970\u7b26\u53ef\u7528\u4e8e\u6307\u793aC\u6216\u8005C++<\/a>\u51fd\u6570\u7684\u8c03\u7528\u89c4\u8303\u3002\u6bd4\u5982\u5728C++<\/a>\u4e2d\u8c03\u7528C\u5e93\u51fd\u6570\uff0c\u5c31\u9700\u8981\u5728C++\u7a0b\u5e8f\u4e2d\u7528extern \u201cC\u201d\u58f0\u660e\u8981\u5f15\u7528\u7684\u51fd\u6570\u3002\u8fd9\u662f\u7ed9\u94fe\u63a5\u5668\u7528\u7684\uff0c\u544a\u8bc9\u94fe\u63a5\u5668\u5728\u94fe\u63a5\u7684\u65f6\u5019\u7528C\u51fd\u6570\u89c4\u8303\u6765\u94fe\u63a5\u3002\u4e3b\u8981\u539f\u56e0\u662fC++\u548cC\u7a0b\u5e8f\u7f16\u8bd1\u5b8c\u6210\u540e\u5728\u76ee\u6807\u4ee3\u7801\u4e2d\u547d\u540d\u89c4\u5219\u4e0d\u540c\u3002<\/p> \n<\/dd>","orderid":"0","title":"\u7b80\u8c08C\u8bed\u8a00\u4e2dextern\u7684\u7528\u6cd5","smalltitle":"","mid":"0","fname":"c\u8bed\u8a00\u7f16\u7a0b","special_id":"0","bak_id":"0","info":"0","hits":"50","pages":"1","comments":"0","posttime":"2016-12-28 08:15:37","list":"1482884137","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":"\u7b80\u8c08<\/A> \u8a00\u4e2d<\/A> extern<\/A> \u7528\u6cd5<\/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":"\u7b80\u8c08C\u8bed\u8a00\u4e2dextern\u7684\u7528\u6cd5","lastview":"1487412001","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}