鱼C论坛

 找回密码
 立即注册
查看: 844|回复: 3

[Error] expected ';', ',' or ')' before '.' token 怎么解决

[复制链接]
发表于 2022-3-23 20:43:12 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
#include <malloc.h>
#include <string.h>
int max(int a.int b);  
main()
{
        int x,y,2;
        int max(int a.int b);
        printf("input two numbers:\n");
        scanf("%d%d,&x,&y");
        z=max(x,y);
        printf("maxnum =%d",2);
}

int max(int a.int b)
{
        if(a>b)return a;else return b;
}
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2022-3-23 20:48:06 | 显示全部楼层
int max(int a,int b);
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2022-3-23 23:04:53 | 显示全部楼层
  1. #include <malloc.h>  
  2. #include <string.h>
  3. #include <stdio.h> // !!!!!!!! 最最最最最最重要的头文件你竟然忘了 !!!!!
  4. int max(int a,int b);   // 英文的逗号 【,】  不是 【.】
  5. main()
  6. {
  7.         int x,y,z; //你把2和z写错了  emmmm
  8. //        int max(int a,int b);  // 这个不需要写
  9.         printf("input two numbers:\n");
  10.         scanf("%d %d",&x,&y); // 语法错了
  11.         z=max(x,y);
  12.         printf("maxnum =%d",z);
  13. }

  14. int max(int a,int b)// 英文的逗号 【,】  不是 【.】
  15. {
  16.         if(a>b)return a;else return b;
  17. }
复制代码

input two numbers:
12 34
maxnum =34
--------------------------------
Process exited after 1.428 seconds with return value 10
请按任意键继续. . .
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 1 反对 0

使用道具 举报

 楼主| 发表于 2022-3-24 08:26:32 | 显示全部楼层
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-5-21 19:27

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表