C语言在声明函数的时候一定要将函数声明在调用函数之前
// Practice.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
void test1() {
printf("TestOne\n");
}
int main() {
int m[4];
printf("%d\n",m[0]);
for(int i = 0;i< sizeof(m) ;i++) {
printf("%d\n",m[i]);
}
test1();
int a;
printf("%d\n",a);
scanf("%d",&a);
return 1;
}
错误的写法是
// Practice.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int main() {
int m[4];
printf("%d\n",m[0]);
for(int i = 0;i< sizeof(m) ;i++) {
printf("%d\n",m[i]);
}
test1();
int a;
printf("%d\n",a);
scanf("%d",&a);
return 1;
}
void test1() {
printf("TestOne\n");
}