「C言語」引数ありの関数を呼び出すサンプル
構文
void 関数名(型 引数1,型 引数2);
サンプルコード
#include <stdio.h>
void testfunc(int x, int y){
/* 変数の宣言 */
int res;
res = x - y;
/* 結果 */
printf("result=%d\n", res);
}
int main(void){
int a = 22;
int b = 10;
/* 関数の呼び出し */
testfunc(a, b);
return 0;
}
実行結果
result=12