C: scanf函数赋值给int需要用&指针取址
用scanf函数赋值给int变量,发现错误。
int country_num=0;
scanf("%d",country_num);//错误,运行报错
查阅后发现,需要用&指针取址。
scanf("%d",&country_num);//正确
本文版权归作者所有,谢绝转发,违者必究。
本文版权归作者所有,谢绝转载,违者必究!
用scanf函数赋值给int变量,发现错误。
int country_num=0;
scanf("%d",country_num);//错误,运行报错
查阅后发现,需要用&指针取址。
scanf("%d",&country_num);//正确
本文版权归作者所有,谢绝转发,违者必究。