fork download
  1. #include <stdio.h>
  2.  
  3. // max関数のプロトタイプ宣言
  4. int max(int, int);
  5.  
  6. // main関数
  7. int main(void) {
  8. int a = 1, b = 5, c = 3, d = 4;
  9.  
  10. // max関数を入れ子にして4つの数の最大値を求める
  11. int result = max(max(a, b), max(c, d));
  12.  
  13. printf("The maximum value is: %d\n", result);
  14. return 0;
  15. }
  16.  
  17. // max関数の定義
  18. int max(int x, int y) {
  19. return (x > y) ? x : y;
  20. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
The maximum value is: 5