标题:c语言初学,大家帮我看看 错在哪里
取消只看楼主
feng198823
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2014-12-6
结帖率:66.67%
已结贴  问题点数:20 回复次数:2 
c语言初学,大家帮我看看 错在哪里
#include "stdafx.h"

int main(int argc, char* argv[])
{

  int max(int x, int y, int z );


  int a,b,c,d;
    d=max(a,b,c);

    scanf("%d,%d,%d",&a,&b,&c);

printf("max=%d\n",d);
return 0;

}

int max(int x,int y,int z)
{
  int f;

  if (x>y) f=x;  
  else f=y;
    if (x>z) f=x;
  else f=z;
 

  if (y>z)
      f=y;
  else f=z;
 
 


    return f;
}
谁能帮我看看  啊   运行的结果不对  ,哪里逻辑出问题了   谢谢 指点
搜索更多相关主题的帖子: c语言 return include 
2014-12-06 22:06
feng198823
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2014-12-6
得分:0 
回复 4 楼 某先生 0422
我学的C语言   自学的
2014-12-07 21:22
feng198823
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2014-12-6
得分:0 
// x1.cpp : Defines the entry point for the console application.
//

#include <stdio.h>

int main()
{

  int max(int x, int y, int z );


  int a,b,c,d;
    d=max(a,b,c);

    scanf("%d %d %d",&a,&b,&c);

printf("max=%d\n",d);
return 0;

}

int max(int x,int y,int z)
{
  int f,n;

  if (x>y) f=x;  
  else f=y;
    if (f>z) n=f;
  else n=z;
 

    return(n);
}



我把main函数里面的定义给删了   运行结果还是-858993460   貌似输出一个带符号4字节整型,这是为什么呀    我用的是
visual c++6.0   编译器运行的c语言,
2014-12-07 21:52



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-439674-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.037596 second(s), 10 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved