Document of c-modernization-kit (calc) 1.0.0
Loading...
Searching...
No Matches
subtract.c File Reference

subtract 関数の実装ファイル。 More...

#include <libcalcbase.h>
#include <stddef.h>
Include dependency graph for subtract.c:

Go to the source code of this file.

Functions

int subtract (const int a, const int b, int *result)
 2 つの整数を減算します。

Detailed Description

subtract 関数の実装ファイル。

Author
c-modenization-kit sample team
Date
2025/11/22
Version
1.0.0

2 つの整数を減算する関数を提供します。

Definition in file subtract.c.

Function Documentation

◆ subtract()

int subtract ( const int a,
const int b,
int * result )

2 つの整数を減算します。

Parameters
[in]a第一オペランド。
[in]b第二オペランド。
[out]result計算結果を格納するポインタ。
Returns
成功時は CALC_SUCCESS、失敗時は CALC_SUCCESS 以外の値を返します。

この関数は 2 つの整数を受け取り、その差を result に格納します。

使用例
int result;
if (subtract(10, 3, &result) == CALC_SUCCESS) {
printf("Result: %d\n", result); // 出力: Result: 7
}
#define CALC_SUCCESS
成功の戻り値を表す定数。
int subtract(const int a, const int b, int *result)
2 つの整数を減算します。
Definition subtract.c:20
Note
オーバーフローが発生する可能性がある場合は、 呼び出し側で範囲チェックを行ってください。
Warning
result が NULL の場合は失敗を返します。

Definition at line 20 of file subtract.c.

References add().

Referenced by calcHandler(), and main().

Here is the call graph for this function:
Here is the caller graph for this function: