{"id":8030,"date":"2025-09-20T08:03:00","date_gmt":"2025-09-19T23:03:00","guid":{"rendered":"https:\/\/www.chihayafuru.jp\/tech\/?p=8030"},"modified":"2025-09-20T08:09:41","modified_gmt":"2025-09-19T23:09:41","slug":"c-c%e3%81%ae%e3%83%98%e3%83%83%e3%83%80%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%81%ab%e8%a8%98%e8%bf%b0%e3%81%99%e3%81%b9%e3%81%8d%e5%86%85%e5%ae%b9%e3%80%81%e8%a8%98%e8%bf%b0%e3%81%99%e3%81%b9","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/8030","title":{"rendered":"C\/C++\u306e\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u306b\u8a18\u8ff0\u3059\u3079\u304d\u5185\u5bb9\u3001\u8a18\u8ff0\u3059\u3079\u304d\u3067\u306a\u3044\u5185\u5bb9"},"content":{"rendered":"<h3>[\u8a18\u8ff0\u3059\u3079\u304d] \u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u30ac\u30fc\u30c9<\/h3>\n<h4>\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u30ac\u30fc\u30c9\u306e\u8a18\u8ff0\u4f8b<\/h4>\n<pre class=\"toolbar:1 lang:c decode:true \" title=\"foo.h\" >#ifndef FOO_H\r\n#define FOO_H\r\n\r\n\/* \u4e2d\u7565 *\/\r\n\r\n#endif \/* FOO_H *\/<\/pre>\n<h4>\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u30ac\u30fc\u30c9\u3092\u8a18\u8ff0\u3059\u3079\u304d\u80cc\u666f<\/h4>\n<p>\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u304b\u3089\u3001\u3055\u3089\u306b\u5225\u306e\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u3092\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u3059\u308b\u3053\u3068\u3067\u3001\u4e00\u3064\u306e\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u304c\uff12\u56de\u4ee5\u4e0a\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u3055\u308c\u308b\u3068\u304d\u304c\u3042\u308b\u3002\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u30ac\u30fc\u30c9\u304c\u8a18\u8ff0\u3055\u308c\u3066\u3044\u306a\u3044\u3068\u540c\u4e00\u306e\u5b9a\u7fa9\u3084\u5ba3\u8a00\u304c\uff12\u56de\u4ee5\u4e0a\u3001\uff11\u3064\u306e\u7ffb\u8a33\u5358\u4f4d\uff08\uff5e.c\u30d5\u30a1\u30a4\u30eb\uff09\u306e\u4e2d\u306b\u73fe\u308c\u3066\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u304c\u751f\u3058\u308b\u305f\u3081\u3002<\/p>\n<h4>define\u540d\u306b\u95a2\u3059\u308b\u88dc\u8db3<\/h4>\n<p>\u63a5\u982d\u8f9e\u306b\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a2\u3092\uff12\u56de\u91cd\u306d\u305f\u30b7\u30f3\u30dc\u30eb\u540d\u306f\u4e88\u7d04\u8a9e\u3067\u3059\u3002 \u6b21\u306e\u3088\u3046\u306adefine\u5b9a\u7fa9\u540d\u306f\u30b7\u30b9\u30c6\u30e0\uff08\u30b3\u30f3\u30d1\u30a4\u30e9\u306a\u3069\uff09\u306e\u4e88\u7d04\u8a9e\u3068\u91cd\u8907\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u4e88\u7d04\u8a9e\u3068\u885d\u7a81\u3059\u308b\u4e0d\u9069\u5207\u306adefine\u540d\u306e\u4f8b\uff1a <code>__FOO_H__<\/code><\/p>\n<p>&nbsp;<\/p>\n<h3>[\u8a18\u8ff0\u3059\u3079\u304d] \u5916\u90e8\u7d50\u5408\u3059\u308b\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306e\u5ba3\u8a00<\/h3>\n<h4>\u5916\u90e8\u7d50\u5408\u306e\u4f8b<\/h4>\n<pre class=\"toolbar:1 lang:c decode:true \" title=\"foo.h\" >extern int number_of_record;\r\nextern int list_of_record[];\r\nextern const char name[];<\/pre>\n<pre class=\"toolbar:1 lang:c decode:true \" title=\"foo.c\" >int number_of_reservation = 0;\r\nint list_of_record[255] = {0, };\r\nconst char name[255] = \"Alice\";<\/pre>\n<pre class=\"toolbar:1 lang:c decode:true \" title=\"bar.c\" >#include \"foo.h\"\r\n\r\n\r\n  number_of_reservation  = 0;\r\n\r\n  \/* ... \u4e2d\u7565 ... *\/\r\n\r\n  int list_of_record[i] = 0;\r\n\r\n  \/* ... \u4e2d\u7565 ... *\/\r\n\r\n  const char* user_name = name;<\/pre>\n<p>&nbsp;<\/p>\n<h3>[\u8a18\u8ff0\u3059\u3079\u304d\u3067\u306a\u3044] \u5185\u90e8\u7d50\u5408\u3059\u308b\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306e\u5ba3\u8a00\u3084\u5b9a\u7fa9<\/h3>\n<h4>\u5185\u90e8\u7d50\u5408\u3059\u308b\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306e\u9069\u5207\u306a\u8a18\u8ff0\u4f4d\u7f6e<\/h4>\n<pre class=\"toolbar:1 lang:c decode:true \" title=\"foo.c\" >static const char name[255] = \"Alice\";<\/pre>\n<h4>\u5185\u90e8\u7d50\u5408\u3059\u308b\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306e\u4e0d\u9069\u5207\u306a\u8a18\u8ff0\u4f4d\u7f6e<\/h4>\n<pre class=\"toolbar:1 lang:c decode:true \" title=\"foo.h\" >static const char name[255] = \"Alice\";<\/pre>\n<p>\u521d\u671f\u5316\u3092\u8a18\u8ff0\u3059\u308b\u3053\u3068\u3067\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306e\u5ba3\u8a00\u3067\u306f\u306a\u304f\u5b9a\u7fa9\u306b\u306a\u308a\u307e\u3059\u3002\u8907\u6570\u306e\u5b9a\u7fa9\u304c\u5b58\u5728\u3059\u308b\u3068\u30ea\u30f3\u30af\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u305f\u3081\u7aae\u4f59\u306e\u4e00\u7b56\uff08\u4e0d\u9069\u5207\u306a\u56de\u907f\u7b56\uff09\u3068\u3057\u3066static\u5ba3\u8a00\u3092\u3057\u3066\u3044\u307e\u3059\u3002\u7d50\u679c\u3068\u3057\u3066\u540d\u524d\u304c\u91cd\u8907\u3059\u308bstatic\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u304c\u8907\u6570\u306e\u7ffb\u8a33\u5358\u4f4d\u306b\u5b58\u5728\u3059\u308b\u7279\u7570\u306a\u72b6\u6cc1\u304c\u751f\u3058\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>[\u8a18\u8ff0\u3059\u3079\u304d\u3067\u306a\u3044] \u30e2\u30b8\u30e5\u30fc\u30eb\u5916\u90e8\u306b\u516c\u958b\u3057\u306a\u3044\u95a2\u6570\u306e\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u5ba3\u8a00<\/h3>\n<p>\u95a2\u6570\u306e\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u5ba3\u8a00\u306f\u7701\u7565\u305b\u305a\u306b\u5fc5\u305a\u8a18\u8ff0\u3057\u307e\u3057\u3087\u3046\u3002\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u5ba3\u8a00\u306e\u8a18\u8ff0\u3092\u7701\u7565\u3057\u3066\u3082\u3001\u305f\u307e\u305f\u307e\u30b3\u30f3\u30d1\u30a4\u30eb\u304c\u6210\u529f\u3059\u308b\u3053\u3068\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u4e00\u65e6\u30b3\u30f3\u30d1\u30a4\u30eb\u304c\u6210\u529f\u3057\u3066\u3082\u3001\u305d\u306e\u5f8c\u306e\u30b3\u30fc\u30c9\u4fee\u6b63\u3067\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u5ba3\u8a00\u306e\u306a\u3044\u30b3\u30fc\u30c9\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\u304c\u5931\u6557\u3059\u308b\u3053\u3068\u304c\u3042\u308b\u305f\u3081\u3001\u304b\u306a\u3089\u305a\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb\u306e\u5148\u982d\u3001\u3082\u3057\u304f\u306f\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u306b\u95a2\u6570\u306e\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u5ba3\u8a00\u3092\u8a18\u8ff0\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u95a2\u6570\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u5ba3\u8a00\u306f\u5fc5\u305a\u3069\u3053\u304b\u306b\u8a18\u8ff0\u3059\u308b\u3002\u3057\u304b\u3057\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u5916\uff08xxx.c\u306e\u5916\u90e8\u3001xxx.o\u306e\u5916\u90e8\uff09\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3059\u308b\u5fc5\u8981\u306e\u306a\u3044 static \u306a\u95a2\u6570\u306e\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u5ba3\u8a00\u3092\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u306b\u8a18\u8ff0\u3057\u3066\u306f\u3044\u3051\u307e\u305b\u3093\u3002 *.c \u30d5\u30a1\u30a4\u30eb\u306e\u5148\u982d\u306b\u8a18\u8ff0\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[\u8a18\u8ff0\u3059\u3079\u304d] \u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u30ac\u30fc\u30c9 \u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u30ac\u30fc\u30c9\u306e\u8a18\u8ff0\u4f8b #ifndef FOO_H #define FOO_H \/* \u4e2d\u7565 *\/ #endif \/* FOO_H *\/ \u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u30ac\u30fc\u30c9\u3092\u8a18\u8ff0\u3059\u3079\u304d\u80cc\u666f \u30d8\u30c3\u30c0\u30d5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-8030","post","type-post","status-publish","format-standard","hentry","category-memo"],"_links":{"self":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/8030","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/comments?post=8030"}],"version-history":[{"count":21,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/8030\/revisions"}],"predecessor-version":[{"id":8141,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/8030\/revisions\/8141"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=8030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=8030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=8030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}