| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1056 人关注过本帖
标题:刚学C语言,出现这个错误请教各位![Error] 'max' was not declared in thi ...
只看楼主 加入收藏
huhq
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2015-3-30
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:7 
刚学C语言,出现这个错误请教各位![Error] 'max' was not declared in this scope
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>


main ()
{
int a,b,c;  /* defined varitions */
scanf("%d,%d",&a,&b);   
c=max (a,b);
printf ("max=%d",c);
}


int max (int x,int y);
{
int z;
if (x>y)z=x;
else z=y;
return (z);
}
搜索更多相关主题的帖子: include C语言 return declared 
2015-03-30 16:29
over1230
Rank: 8Rank: 8
等 级:贵宾
威 望:25
帖 子:113
专家分:897
注 册:2009-10-9
收藏
得分:20 

int max (int x,int y);
 后面多了个“;”
这个好像来错地方了,这个是c#的,不是C的,建议去C那边问。
2015-03-30 16:51
huhq
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2015-3-30
收藏
得分:0 
楼上:去掉";"后编译出同样的错误提示。
2015-03-30 16:55
sun282430724
Rank: 2
等 级:论坛游民
威 望:1
帖 子:30
专家分:94
注 册:2015-4-20
收藏
得分:0 
路过
2015-04-20 13:57
Libing_
Rank: 2
等 级:论坛游民
威 望:1
帖 子:18
专家分:31
注 册:2015-4-26
收藏
得分:0 
#include <stdio.h>
#include <Stdlib.h>
#include <string.h>
#include <math.h>

void main()
{
    int a,b,c;
    scanf("%d,%d",&a,&b);   
    c=max (a,b);
   
    printf ("max=%d",c);
   
}


int max(int x, int y)
{
    int z;
    if(x > y)
    {
        z = x;
    }
    else
    {
        z = y;
    }
    return z;
}
//也可以这样
int max2(int x, int y)
{
    return x > y ? x,y;
}
2015-04-26 18:31
Libing_
Rank: 2
等 级:论坛游民
威 望:1
帖 子:18
专家分:31
注 册:2015-4-26
收藏
得分:0 
extern int amx();
2015-04-26 18:56
nidehouge
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2015-4-26
收藏
得分:0 
新手球带
2015-04-26 19:21
低调丶小四
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-4-28
收藏
得分:0 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>


main ()
{
int a,b,c;  /* defined varitions */
scanf("%d,%d",&a,&b);   
c=max (a,b);
printf ("max=%d",c);
}


int max (int x,int y)
{
int z;
if (x>y)z=x;
else z=y;
return (z);
}

多了个分号,在  int max(int x,int y)
2015-04-28 19:37
快速回复:刚学C语言,出现这个错误请教各位![Error] 'max' was not declared i ...
数据加载中...
 
   



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

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