注册 登录
编程论坛 C++教室

求助 为什么1.程序会输出9,而2.程序会输出1000?

Theunkown 发布于 2016-04-26 16:00, 3887 次点击
1.#include "stdio.h"
int a=3,b=9;
int max(int a,int b)
{ int c;
    c=1000;//a>b?a:b
    return ;
   
    }
void main()
{
    int a=1000;
    printf("%d",max(a,b));
}
2.#include "stdio.h"
int a=3,b=9;
int max(int a,int b)
{ int c;
    c=a>b?a:b
    return ;
   
    }
void main()
{
    int a=1000;
    printf("%d",max(a,b));
}
4 回复
#2
rjsp2016-04-26 16:07
只要知道它们都是错误的就行了
有句话“把正确的事做正确,不要浪费时间在错误的事情上”,是谁说的我忘了。
#3
c9742884322016-04-27 10:40
回复 2楼 rjsp
厉害的话  
#4
yangfrancis2016-04-27 18:32
回复 楼主 Theunkown
函数没有返回值编译都通过了吗?人品太好了吧。
#5
Theunkown2016-04-27 21:03
回复 4楼 yangfrancis
这个确实通过了
1