C不支持函数重载,C++支持

代码演示

main.c

 1 #include<stdio.h>
 2 
 3 void Max(int a, int b)
 4 {
 5     printf("%d  ", a > b ? a : b) ;
 6 }
 7 
 8 void Max(double a, double b)
 9 {
10     printf("%f  ", a > b ? a : b);
11 }
12 
13 int main()
14 {
15     Max(1,2);
16     Max(1.0, 2.0);
17     return 0;
18 }
View Code

相关文章:

  • 2021-07-31
  • 2022-02-09
  • 2022-12-23
  • 2021-09-16
  • 2021-12-11
  • 2021-12-10
猜你喜欢
  • 2021-08-28
  • 2021-06-24
  • 2022-12-23
  • 2023-03-05
  • 2021-12-10
  • 2021-08-18
相关资源
相似解决方案