{"id":296,"date":"2023-02-22T02:21:05","date_gmt":"2023-02-22T10:21:05","guid":{"rendered":"http:\/\/bitas.net.cn\/?page_id=296"},"modified":"2023-02-22T02:21:12","modified_gmt":"2023-02-22T10:21:12","slug":"103-2","status":"publish","type":"page","link":"http:\/\/bitas.net.cn\/index.php\/sourcecode\/103-2\/","title":{"rendered":"103 \u52a8\u6001\u6570\u636e\u7ed3\u6784"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h>\n#include &lt;stddef.h>\n\ntypedef struct tagIDCard {\n    long serialNo;    \/\/ 6\u4f4d\u6570\u7684\u5e8f\u5217\u53f7\n    char name&#91;32];    \/\/ \u540d\u79f0\n} IDCard;\n\ntypedef struct tagStudent {\n    char gender;    \/\/ F or M\n    unsigned short age;\n    IDCard id; \n    struct tagStudent *next;\n} Student;\n\nvoid print_student(Student *ps)\n{\n    if (ps) {\n        if (ps->id.serialNo &lt; 200000)\n            ps->id.serialNo += 200000;\n        printf(\"%15s: %c\\n\"\n                \"%15s: %hd\\n\"\n                \"%15s: %ld\\n\"\n                \"%15s: %s\\n\",\n                \"Gender\", ps->gender,\n                \"Age\", ps->age,\n                \"ID SerialNo.\", ps->id.serialNo,\n                \"ID name\", ps->id.name);\n        printf(\"-------------------------\\n\");\n    }   \n}\n\nint main(int argc, char *argv&#91;])\n{\n    Student s1 = { 'F', 20, { 200101, \"x1\" }, NULL };\n    Student s2 = { 'M', 21, { 200102, \"x2\" }, NULL };\n    Student s3 = { 'F', 22, { 200103, \"x3\" }, NULL };\n    s1.next = &amp;s2;\n    s2.next = &amp;s3;\n    for (Student *ps = &amp;s1; ps != NULL; ps = ps->next )\n        print_student(ps);\n    return 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":127,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-296","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/pages\/296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/comments?post=296"}],"version-history":[{"count":1,"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/pages\/296\/revisions"}],"predecessor-version":[{"id":297,"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/pages\/296\/revisions\/297"}],"up":[{"embeddable":true,"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/pages\/127"}],"wp:attachment":[{"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/media?parent=296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}