马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
代码如下:#include <stdio.h>
void get_array (int b[10])
{
printf("sizeof b is %d\n",sizeof(b));
}
int main() {
int a[10] = {1,2,3,4,5,6,7,8,9,0};
printf("sizeof a is %d\n",sizeof(a));
get_array(a);
return 0;
}
错误如下:/usercode/file.cpp: In function ‘void get_array(int*)’:
/usercode/file.cpp:5:40: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
printf("sizeof b is %d\n",sizeof(b));
^
/usercode/file.cpp: In function ‘int main()’:
/usercode/file.cpp:10:37: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
printf("sizeof a is %d\n",sizeof(a));
^
|