K&R C style:
#include <stdio.h> int add(x, y) int x, y; { return x + y; } int main() { int a = 2; int b = 3; int c = add(a, b); printf("%d\n", c); return 0; }
上面的程序在VC6.0的.cpp文件中有错误,但在.c文件中可以正常.
ANSI C style:
#include <stdio.h> int add(int x, int y) { return x + y; } int main() { int a = 2; int b = 3; int c = add(a, b); printf("%d\n", c); return 0; }
时间: 2024-10-14 12:47:52