这是我的程序(变量是德语)
int ABFRAGE(int max,int min){
int eingabe;
do {
printf("\t>");
scanf("%i",&eingabe);
} while (eingabe > max || eingabe < min);
return eingabe;
}
#define ABFRAGEERGEBNIS Abfrageergebnis = (int)ABFRAGE
int main(void);
int Abfrageergebnis;
ABFRAGEERGEBNIS; <-!
if (Abfrageergebnis == 2)
NAMENSAENDERUNG(i,Name);
if (Abfrageergebnis == 1)
getchar();
STRING_PROLOG;
它应该得到一个数字,保存它并执行该操作,if 部分说的是什么。但在 <-!是警告
最佳答案
我认为,使用您当前的代码,您正在将内存地址读入 int 中,这不是您想要做的。我建议您编写第二行代码 int *eingabe;
。
编辑:我完全错了。我认为错误在这里:#define ABFRAGEERGEBNIS Abfrageergebnis = (int)ABFRAGE
。您正在调用函数 ABFRAGE 但未指定参数 max 和 min。你也不需要 (int) 那里。
函数 ABFRAGE 本身就很好 - 您只需将我提到的行更改为 #define ABFRAGEERGEBNIS Abfrageergebnis = ABFRAGE(max, min)
。您还需要定义 max 和 min,这是我在测试时在 main 中所做的。
关于c - 警告 : cast from pointer to integer of different size [-Wpointer-to-int-cast],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21887998/