{"id":29,"date":"2007-04-28T22:52:36","date_gmt":"2007-04-28T14:52:36","guid":{"rendered":"http:\/\/127.0.0.1\/website_linux\/blog\/?p=29"},"modified":"2007-04-28T22:52:36","modified_gmt":"2007-04-28T14:52:36","slug":"%e9%93%be%e8%a1%a8%e7%9a%84c%e8%af%ad%e8%a8%80%e5%ae%9e%e7%8e%b0%e4%b9%8b%e5%8d%95%e9%93%be%e8%a1%a8%e7%9a%84%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/opgogo.com\/blog2\/?p=29","title":{"rendered":"\u94fe\u8868\u7684C\u8bed\u8a00\u5b9e\u73b0\u4e4b\u5355\u94fe\u8868\u7684\u5b9e\u73b0"},"content":{"rendered":"<p>\u94fe\u8868\u7684C\u8bed\u8a00\u5b9e\u73b0\u4e4b\u5355\u94fe\u8868\u7684\u5b9e\u73b0<\/p>\n<p>http:\/\/www.programfan.com\/article\/showarticle.asp?id=2779<\/p>\n<p>\u3000\u3000\u4e00\u3001\u5355\u94fe\u8868\u7684\u5efa\u7acb<\/p>\n<p>\u3000\u3000\u6709\u4e86\u52a8\u6001\u5185\u5b58\u5206\u914d\u7684\u57fa\u7840\uff0c\u8981\u5b9e\u73b0\u94fe\u8868\u5c31\u4e0d\u96be\u4e86\u3002<\/p>\n<p>\u3000\u3000\u6240\u8c13\u94fe\u8868\uff0c\u5c31\u662f\u7528\u4e00\u7ec4\u4efb\u610f\u7684\u5b58\u50a8\u5355\u5143\u5b58\u50a8\u7ebf\u6027\u8868\u5143\u7d20\u7684\u4e00\u79cd\u6570\u636e\u7ed3\u6784\u3002\u94fe\u8868\u53c8\u5206\u4e3a\u5355\u94fe\u8868\u3001\u53cc\u5411\u94fe\u8868\u548c\u5faa\u73af\u94fe\u8868\u7b49\u3002\u6211\u4eec\u5148\u8bb2\u8bb2\u5355\u94fe\u8868\u3002\u6240\u8c13\u5355\u94fe\u8868\uff0c\u662f\u6307\u6570\u636e\u63a5\u70b9\u662f\u5355\u5411\u6392\u5217\u7684\u3002\u4e00\u4e2a\u5355\u94fe\u8868\u7ed3\u70b9\uff0c\u5176\u7ed3\u6784\u7c7b\u578b\u5206\u4e3a\u4e24\u90e8\u5206\uff1a<\/p>\n<p>\u3000\u30001\u3001\u6570\u636e\u57df\uff1a\u7528\u6765\u5b58\u50a8\u672c\u8eab\u6570\u636e<\/p>\n<p>\u3000\u30002\u3001\u94fe\u57df\u6216\u79f0\u4e3a\u6307\u9488\u57df\uff1a\u7528\u6765\u5b58\u50a8\u4e0b\u4e00\u4e2a\u7ed3\u70b9\u5730\u5740\u6216\u8005\u8bf4\u6307\u5411\u5176\u76f4\u63a5\u540e\u7ee7\u7684\u6307\u9488\u3002<\/p>\n<p>\u3000\u3000\u4f8b\uff1a<\/p>\n<p>typedef struct node<br \/>\n{<br \/>\n\u3000char name[20];<br \/>\n\u3000struct node *link;<br \/>\n}stud;<\/p>\n<p>\u3000\u3000\u8fd9\u6837\u5c31\u5b9a\u4e49\u4e86\u4e00\u4e2a\u5355\u94fe\u8868\u7684\u7ed3\u6784\uff0c\u5176\u4e2dchar name[20]\u662f\u4e00\u4e2a\u7528\u6765\u5b58\u50a8\u59d3\u540d\u7684\u5b57\u7b26\u578b\u6570\u7ec4\uff0c\u6307\u9488*link\u662f\u4e00\u4e2a\u7528\u6765\u5b58\u50a8\u5176\u76f4\u63a5\u540e\u7ee7\u7684\u6307\u9488\u3002<\/p>\n<p>\u3000\u3000\u5b9a\u4e49\u597d\u4e86\u94fe\u8868\u7684\u7ed3\u6784\u4e4b\u540e\uff0c\u53ea\u8981\u5728\u7a0b\u5e8f\u8fd0\u884c\u7684\u65f6\u5019\u7231\u6570\u636e\u57df\u4e2d\u5b58\u50a8\u9002\u5f53\u7684\u6570\u636e\uff0c\u5982\u6709\u540e\u7ee7\u7ed3\u70b9\uff0c\u5219\u628a\u94fe\u57df\u6307\u5411\u5176\u76f4\u63a5\u540e\u7ee7\uff0c\u82e5\u6ca1\u6709\uff0c\u5219\u7f6e\u4e3aNULL\u3002<\/p>\n<p>\u3000\u3000\u4e0b\u9762\u5c31\u6765\u770b\u4e00\u4e2a\u5efa\u7acb\u5e26\u8868\u5934\uff08\u82e5\u672a\u8bf4\u660e\uff0c\u4ee5\u4e0b\u6240\u6307\u94fe\u8868\u5747\u5e26\u8868\u5934\uff09\u7684\u5355\u94fe\u8868\u7684\u5b8c\u6574\u7a0b\u5e8f\u3002<\/p>\n<p>#include \uff1cstdio.h\uff1e<br \/>\n#include \uff1cmalloc.h\uff1e \/*\u5305\u542b\u52a8\u6001\u5185\u5b58\u5206\u914d\u51fd\u6570\u7684\u5934\u6587\u4ef6*\/<br \/>\n#define N 10 \/*N\u4e3a\u4eba\u6570*\/<br \/>\ntypedef struct node<br \/>\n{<br \/>\n\u3000char name[20];<br \/>\n\u3000struct node *link;<br \/>\n}stud;<br \/>\nstud * creat(int n) \/*\u5efa\u7acb\u5355\u94fe\u8868\u7684\u51fd\u6570\uff0c\u5f62\u53c2n\u4e3a\u4eba\u6570*\/<br \/>\n{<br \/>\n\u3000stud *p,*h,*s; \/* *h\u4fdd\u5b58\u8868\u5934\u7ed3\u70b9\u7684\u6307\u9488\uff0c*p\u6307\u5411\u5f53\u524d\u7ed3\u70b9\u7684\u524d\u4e00\u4e2a\u7ed3\u70b9\uff0c*s\u6307\u5411\u5f53\u524d\u7ed3\u70b9*\/<br \/>\n\u3000int i; \/*\u8ba1\u6570\u5668*\/<br \/>\n\u3000if((h=(stud *)malloc(sizeof(stud)))==NULL) \/*\u5206\u914d\u7a7a\u95f4\u5e76\u68c0\u6d4b*\/<br \/>\n\u3000{<br \/>\n\u3000\u3000printf(&#8220;\u4e0d\u80fd\u5206\u914d\u5185\u5b58\u7a7a\u95f4!&#8221;);<br \/>\n\u3000\u3000exit(0);<br \/>\n\u3000}<br \/>\n\u3000h-\uff1ename[0]=&#39;\\0&#39;; \/*\u628a\u8868\u5934\u7ed3\u70b9\u7684\u6570\u636e\u57df\u7f6e\u7a7a*\/<br \/>\n\u3000h-\uff1elink=NULL; \/*\u628a\u8868\u5934\u7ed3\u70b9\u7684\u94fe\u57df\u7f6e\u7a7a*\/<br \/>\n\u3000p=h; \/*p\u6307\u5411\u8868\u5934\u7ed3\u70b9*\/<br \/>\n\u3000for(i=0;i\uff1cn;i++)<br \/>\n\u3000{<br \/>\n\u3000\u3000if((s= (stud *) malloc(sizeof(stud)))==NULL) \/*\u5206\u914d\u65b0\u5b58\u50a8\u7a7a\u95f4\u5e76\u68c0\u6d4b*\/<br \/>\n\u3000\u3000{<br \/>\n\u3000\u3000\u3000printf(&#8220;\u4e0d\u80fd\u5206\u914d\u5185\u5b58\u7a7a\u95f4!&#8221;);<br \/>\n\u3000\u3000\u3000exit(0);<br \/>\n\u3000\u3000}<br \/>\n\u3000\u3000p-\uff1elink=s; \/*\u628as\u7684\u5730\u5740\u8d4b\u7ed9p\u6240\u6307\u5411\u7684\u7ed3\u70b9\u7684\u94fe\u57df\uff0c\u8fd9\u6837\u5c31\u628ap\u548cs\u6240\u6307\u5411\u7684\u7ed3\u70b9\u8fde\u63a5\u8d77\u6765\u4e86*\/<br \/>\n\u3000\u3000printf(&#8220;\u8bf7\u8f93\u5165\u7b2c%d\u4e2a\u4eba\u7684\u59d3\u540d&#8221;,i+1);<br \/>\n\u3000\u3000scanf(&#8220;%s&#8221;,s-\uff1ename); \/*\u5728\u5f53\u524d\u7ed3\u70b9s\u7684\u6570\u636e\u57df\u4e2d\u5b58\u50a8\u59d3\u540d*\/<br \/>\n\u3000\u3000s-\uff1elink=NULL;<br \/>\n\u3000\u3000p=s;<br \/>\n\u3000}<br \/>\n\u3000return(h);<br \/>\n}<br \/>\nmain()<br \/>\n{<br \/>\n\u3000int number; \/*\u4fdd\u5b58\u4eba\u6570\u7684\u53d8\u91cf*\/<br \/>\n\u3000stud *head; \/*head\u662f\u4fdd\u5b58\u5355\u94fe\u8868\u7684\u8868\u5934\u7ed3\u70b9\u5730\u5740\u7684\u6307\u9488*\/<br \/>\n\u3000number=N;<br \/>\n\u3000head=creat(number); \/*\u628a\u6240\u65b0\u5efa\u7684\u5355\u94fe\u8868\u8868\u5934\u5730\u5740\u8d4b\u7ed9head*\/<br \/>\n}<\/p>\n<p>\u3000\u3000\u8fd9\u6837\u5c31\u5199\u597d\u4e86\u4e00\u4e2a\u53ef\u4ee5\u5efa\u7acb\u5305\u542bN\u4e2a\u4eba\u59d3\u540d\u7684\u5355\u94fe\u8868\u4e86\u3002\u5199\u52a8\u6001\u5185\u5b58\u5206\u914d\u7684\u7a0b\u5e8f\u5e94\u6ce8\u610f\uff0c\u8bf7\u5c3d\u91cf\u5bf9\u5206\u914d\u662f\u5426\u6210\u529f\u8fdb\u884c\u68c0\u6d4b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u94fe\u8868\u7684C\u8bed\u8a00\u5b9e\u73b0\u4e4b\u5355\u94fe\u8868\u7684\u5b9e\u73b0 http:\/\/www.programfan.com\/article\/showarticle.asp?id=2779 \u3000\u3000\u4e00\u3001\u5355\u94fe\u8868\u7684\u5efa\u7acb \u3000\u3000\u6709\u4e86\u52a8\u6001\u5185\u5b58\u5206\u914d\u7684\u57fa\u7840\uff0c\u8981&hellip; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[28],"tags":[],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-computer"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/opgogo.com\/blog2\/index.php?rest_route=\/wp\/v2\/posts\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opgogo.com\/blog2\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opgogo.com\/blog2\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opgogo.com\/blog2\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/opgogo.com\/blog2\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=29"}],"version-history":[{"count":0,"href":"https:\/\/opgogo.com\/blog2\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions"}],"wp:attachment":[{"href":"https:\/\/opgogo.com\/blog2\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opgogo.com\/blog2\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opgogo.com\/blog2\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}