求两个整数中较大者,运行就出错
新手,照着书敲的,为啥一运行就提示错误呢,求解啊!谢谢。程序代码:
#include <stdio.h> int main( ) { int max(int x, int y); int a, b, c; scanf("%d,%d", &a, &b); c = max(a, b); printf("zuidazhi=%d\n",c); return 0; } int max(int x, int y); { int z; if (x > y)z = x; else z = y; return(z); }
错误提示
1>------ 已启动生成: 项目: ConsoleApplication1, 配置: Debug Win32 ------
1> 2.c
1>e:\cdemo\consoleapplication1\consoleapplication1\2.c(6): warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\windows kits\10\include\10.0.10150.0\ucrt\stdio.h(1270): note: 参见“scanf”的声明
1>e:\cdemo\consoleapplication1\consoleapplication1\2.c(12): error C2449: 在文件范围内找到“{”(是否缺少函数头?)
1>e:\cdemo\consoleapplication1\consoleapplication1\2.c(17): error C2059: 语法错误:“}”
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========