{"id":45729,"date":"2023-10-04T23:20:43","date_gmt":"2023-10-04T15:20:43","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=45729"},"modified":"2023-10-04T23:20:43","modified_gmt":"2023-10-04T15:20:43","slug":"krhcjsz","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/45729.html","title":{"rendered":"Keil\u5982\u4f55\u521b\u5efa\u6570\u7ec4"},"content":{"rendered":"
Keil\u662f\u4e00\u6b3e\u4e13\u4e1a\u7684\u5d4c\u5165\u5f0f\u7cfb\u7edf\u5f00\u53d1\u8f6f\u4ef6\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u6784\u5efa\u548c\u8c03\u8bd5\u5d4c\u5165\u5f0f\u7cfb\u7edf\uff0c\u4e5f\u53ef\u4ee5\u7528\u6765\u521b\u5efa\u6570\u7ec4\u3002\u672c\u6587\u5c06\u4ecb\u7ecdKeil\u5982\u4f55\u521b\u5efa\u6570\u7ec4\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u6570\u7ec4\u6765\u5b9e\u73b0\u66f4\u591a\u7684\u5e94\u7528\u3002<\/p>\n
Keil\u7ed9\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u591a\u79cd\u521b\u5efa\u6570\u7ec4\u7684\u65b9\u6cd5\uff0c\u5305\u62ec\u9759\u6001\u6570\u7ec4\u548c\u52a8\u6001\u6570\u7ec4\u3002<\/p>\n
\u9759\u6001\u6570\u7ec4\u662f\u5728\u7f16\u8bd1\u65f6\u5c31\u5206\u914d\u597d\u5185\u5b58\u7a7a\u95f4\u7684\u6570\u7ec4\uff0c\u5b83\u7684\u5927\u5c0f\u662f\u56fa\u5b9a\u7684\uff0c\u4e0d\u80fd\u6539\u53d8\u3002\u5728Keil\u4e2d\uff0c\u9759\u6001\u6570\u7ec4\u7684\u521b\u5efa\u548cC\u8bed\u8a00\u4e2d\u7684\u4e00\u6837\uff0c\u53ea\u9700\u8981\u5728\u5b9a\u4e49\u6570\u7ec4\u65f6\uff0c\u6307\u5b9a\u6570\u7ec4\u7684\u5927\u5c0f\u5373\u53ef\uff0c\u5982\uff1a<\/p>\n
int array[10];<\/code><\/pre>\n \u4e0a\u9762\u7684\u4ee3\u7801\u8868\u793a\u521b\u5efa\u4e86\u4e00\u4e2a\u957f\u5ea6\u4e3a10\u7684\u6574\u578b\u6570\u7ec4\uff0c\u53ef\u4ee5\u4f7f\u7528\u7d22\u5f15\u6765\u8bbf\u95ee\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\uff0c\u5982\uff1aarray[0]\u8868\u793a\u7b2c\u4e00\u4e2a\u5143\u7d20\uff0carray[1]\u8868\u793a\u7b2c\u4e8c\u4e2a\u5143\u7d20\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002<\/p>\n
\u52a8\u6001\u6570\u7ec4<\/h3>\n
\u52a8\u6001\u6570\u7ec4\u662f\u5728\u7a0b\u5e8f\u8fd0\u884c\u65f6\u624d\u5206\u914d\u5185\u5b58\u7a7a\u95f4\u7684\u6570\u7ec4\uff0c\u5b83\u7684\u5927\u5c0f\u53ef\u4ee5\u52a8\u6001\u6539\u53d8\u3002\u5728Keil\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528malloc\u51fd\u6570\u6765\u52a8\u6001\u521b\u5efa\u6570\u7ec4\uff0c\u5982\uff1a<\/p>\n
int *array = (int *)malloc(10 * sizeof(int));<\/code><\/pre>\n \u4e0a\u9762\u7684\u4ee3\u7801\u8868\u793a\u521b\u5efa\u4e86\u4e00\u4e2a\u957f\u5ea6\u4e3a10\u7684\u6574\u578b\u6570\u7ec4\uff0c\u53ef\u4ee5\u4f7f\u7528\u7d22\u5f15\u6765\u8bbf\u95ee\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\uff0c\u5982\uff1aarray[0]\u8868\u793a\u7b2c\u4e00\u4e2a\u5143\u7d20\uff0carray[1]\u8868\u793a\u7b2c\u4e8c\u4e2a\u5143\u7d20\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u52a8\u6001\u6570\u7ec4\u521b\u5efa\u5b8c\u6210\u540e\uff0c\u9700\u8981\u4f7f\u7528free\u51fd\u6570\u6765\u91ca\u653e\u5185\u5b58\u7a7a\u95f4\u3002<\/p>\n
Keil\u4f7f\u7528\u6570\u7ec4\u7684\u5e94\u7528<\/h2>\n
Keil\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u6765\u5b9e\u73b0\u66f4\u591a\u7684\u5e94\u7528\uff0c\u5982\u6392\u5e8f\u3001\u67e5\u627e\u7b49\u3002<\/p>\n
\u6392\u5e8f<\/h3>\n
Keil\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u6765\u5bf9\u6570\u636e\u8fdb\u884c\u6392\u5e8f\uff0c\u6bd4\u5982\u5192\u6ce1\u6392\u5e8f\u3001\u5feb\u901f\u6392\u5e8f\u7b49\u3002\u8fd9\u4e9b\u6392\u5e8f\u7b97\u6cd5\u90fd\u662f\u57fa\u4e8e\u6570\u7ec4\u7684\uff0c\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u6765\u5b9e\u73b0\u3002<\/p>\n
\u67e5\u627e<\/h3>\n
Keil\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u6765\u5b9e\u73b0\u67e5\u627e\u64cd\u4f5c\uff0c\u6bd4\u5982\u987a\u5e8f\u67e5\u627e\u3001\u4e8c\u5206\u67e5\u627e\u7b49\u3002\u8fd9\u4e9b\u67e5\u627e\u7b97\u6cd5\u90fd\u662f\u57fa\u4e8e\u6570\u7ec4\u7684\uff0c\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u6765\u5b9e\u73b0\u3002<\/p>\n
\u603b\u7ed3<\/h2>\n
\u672c\u6587\u4ecb\u7ecd\u4e86Keil\u5982\u4f55\u521b\u5efa\u6570\u7ec4\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u6570\u7ec4\u6765\u5b9e\u73b0\u66f4\u591a\u7684\u5e94\u7528\u3002<\/strong>Keil\u53ef\u4ee5\u4f7f\u7528\u9759\u6001\u6570\u7ec4\u548c\u52a8\u6001\u6570\u7ec4\u6765\u521b\u5efa\u6570\u7ec4\uff0c\u5e76\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u6765\u5b9e\u73b0\u6392\u5e8f\u548c\u67e5\u627e\u64cd\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Keil\u662f\u4e00\u6b3e\u4e13\u4e1a\u7684\u5d4c\u5165\u5f0f\u7cfb\u7edf\u5f00\u53d1\u8f6f\u4ef6\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u6784\u5efa\u548c\u8c03\u8bd5\u5d4c\u5165\u5f0f\u7cfb\u7edf\uff0c\u4e5f\u53ef\u4ee5\u7528\u6765\u521b\u5efa\u6570\u7ec4\u3002\u672c\u6587\u5c06\u4ecb\u7ecdKeil\u5982\u4f55\u521b\u5efa\u6570\u7ec4\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u6570\u7ec4\u6765\u5b9e\u73b0\u66f4\u591a\u7684\u5e94\u7528\u3002<\/p>\n","protected":false},"author":1,"featured_media":4132,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[305],"class_list":["post-45729","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-dzjs"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/45729","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/comments?post=45729"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/45729\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/4132"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=45729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=45729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=45729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}