{"id":328,"date":"2023-02-22T02:37:56","date_gmt":"2023-02-22T10:37:56","guid":{"rendered":"http:\/\/bitas.net.cn\/?page_id=328"},"modified":"2023-02-22T02:38:03","modified_gmt":"2023-02-22T10:38:03","slug":"118-2","status":"publish","type":"page","link":"http:\/\/bitas.net.cn\/index.php\/sourcecode\/118-2\/","title":{"rendered":"118 \u5185\u5b58\u6cc4\u6f0f"},"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 tagIDCard {\n    long serialNo;\n    char name&#91;32];\n} IDCard;\n\nIDCard *make_idcard(long serialNo, char *name)\n{\n    IDCard *id;\n    if ((id = malloc(sizeof(IDCard))) == NULL)\n        return NULL;\n    id->serialNo = serialNo;\n    strcpy(id->name, name);\n    return id; \n}\n\nvoid print_idcard(IDCard *id)\n{\n    if (id) {\n        printf(\"%20s: %ld\\n\"\n                \"%20s: %s\\n\",\n                \"ID SerialNo.\", id->serialNo,\n                \"ID name\", id->name);\n    }   \n}\n\nint main(int argc, char *argv&#91;])\n{\n    IDCard *id = make_idcard(200401L, \"x401\");\n    printf(\"sizeof IDCard object: %ld\\n\",\n        sizeof(*id));\n    if (id) {\n        print_idcard(id);\n        \/\/free(id);\n    }   \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-328","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/pages\/328","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=328"}],"version-history":[{"count":1,"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/pages\/328\/revisions"}],"predecessor-version":[{"id":329,"href":"http:\/\/bitas.net.cn\/index.php\/wp-json\/wp\/v2\/pages\/328\/revisions\/329"}],"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=328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}