コンテンツにスキップ

ヘッダファイル

出典: フリー百科事典『ウィキペディア(Wikipedia)』

: Header fileCC++使使: Include file

1

CC++[1]CC++

[]


使
int add(int a, int b)
{
    return a + b;
}

この関数を別のソースファイルで参照するには、関数プロトタイプで宣言する必要がある。従って、次のようになる。

extern int add(int, int);

int triple(int x)
{
    return add(x, add(x, x));
}

 add 使

 add add 使 #include 使
#ifndef H_ADD
#define H_ADD

extern int add(int, int);

#endif
#include "add.h"

int triple(int x)
{
    return add(x, add(x, x));
}


#include "add.h"

int add(int a, int b)
{
    return a + b;
}

使使CC++

[]


2

JavaC++[2]

脚注[編集]

  1. ^ C11 standard, 7.1.2 Standard headers, p. 181, footnote 182: "A header is not necessarily a source file, nor are the < and > delimited sequences in header names necessarily valid source file names.
  2. ^ A Module System for C++ (Revision 4)” (PDF) (英語). JTC1/SC22/WG21 - The C++ Standards Committee (2016年2月15日). 2016年6月5日閲覧。

関連項目[編集]

外部リンク[編集]