{"id":304,"date":"2023-02-22T02:25:08","date_gmt":"2023-02-22T10:25:08","guid":{"rendered":"http:\/\/bitas.net.cn\/?page_id=304"},"modified":"2023-02-22T02:25:17","modified_gmt":"2023-02-22T10:25:17","slug":"106-2","status":"publish","type":"page","link":"http:\/\/bitas.net.cn\/index.php\/sourcecode\/106-2\/","title":{"rendered":"106 \u5f39\u6027\u7ed3\u6784\u6210\u5458"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h>\n#include &lt;stdlib.h>\n#include &lt;string.h>\n\ntypedef struct tagHyperIDCard {\n    long serialNo;\n    char name&#91;32];\n    char *phoneNo&#91;];\n} HyperIDCard;\n\nvoid print_hyperidcard(HyperIDCard *ph, int phones)\n{\n    if (ph) {\n        if (ph->serialNo &lt; 200000)\n            ph->serialNo += 200000;\n        printf( \"%15s: %ld\\n\"\n                \"%15s: %s\\n\",\n                \"ID SerialNo.\", ph->serialNo,\n                \"ID name\", ph->name);\n        for (int p = 0; p &lt; phones; p++) {\n            printf(\"%13s% 2d: %s\\n\",\n                \"phone#\", p+1, ph->phoneNo&#91;p]);\n        }   \n        printf(\"-------------------------\\n\");\n    }   \n}\n\nint main(int argc, char *argv&#91;])\n{\n    HyperIDCard hid1 = { 200201, \"y1\" };\n    \/\/HyperIDCard hid1 = { 200201, \"y1\", { \"0\" } };\n    print_hyperidcard(&amp;hid1, 0); \n    HyperIDCard *ph2 = malloc(sizeof(HyperIDCard) +\n        2 * sizeof(char *));\n    if (ph2) {\n        ph2->serialNo = 200202;\n        strcpy(ph2->name, \"y2\");\n        ph2->phoneNo&#91;0] = \"13012345678\";\n        ph2->phoneNo&#91;1] = \"13112345678\";\n    }   \n    print_hyperidcard(ph2, 2); \n    HyperIDCard *ph3 = malloc(sizeof(HyperIDCard) +\n        3 * sizeof(char *));\n    ph3->phoneNo&#91;0] = \"0\";\n    ph3->phoneNo&#91;1] = \"0\";\n    ph3->phoneNo&#91;2] = \"0\";\n    if (ph3)\n        *ph3 = *ph2;\n    print_hyperidcard(ph3, 3);\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-304","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/pages\/304","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=304"}],"version-history":[{"count":1,"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/pages\/304\/revisions"}],"predecessor-version":[{"id":305,"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/pages\/304\/revisions\/305"}],"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=304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}