devc不断返回错误的值 #包括 #包括 main() { int n; printf(“介绍un número entero”\n); scanf(“%d”和“&n”); printf(“已经介绍了el número:%d”、&n); }
每次我运行这个C代码时,我都会得到6487628 for n,我已经一次又一次地卸载和安装了它,它一直在这样做,我不知道还能做什么。你不想在printf()中使用&n,你想要的是n。您正在显示存储在Typo:devc不断返回错误的值 #包括 #包括 main() { int n; printf(“介绍un número entero”\n); scanf(“%d”和“&n”); printf(“已经介绍了el número:%d”、&n); },c,dev-c++,C,Dev C++,每次我运行这个C代码时,我都会得到6487628 for n,我已经一次又一次地卸载和安装了它,它一直在这样做,我不知道还能做什么。你不想在printf()中使用&n,你想要的是n。您正在显示存储在Typo:printf(“…:%d,&n)”中的内存位置n应该是:printf(“…:%d”,n),&n是该值的内存地址。“我不知道还能做什么。”-可能在启用警告的情况下进行编译…情况并非如此:您的程序返回您告诉它的值。如果它没有返回您期望的值,应该可以告诉您有关错误的信息。我很惊讶您每次都会得到64
printf(“…:%d,&n)”中的内存位置n代码>应该是:printf(“…:%d”,n)
,&n
是该值的内存地址。“我不知道还能做什么。”-可能在启用警告的情况下进行编译…情况并非如此:您的程序返回您告诉它的值。如果它没有返回您期望的值,应该可以告诉您有关错误的信息。我很惊讶您每次都会得到6487628
#include <stdio.h>
#include <stdlib.h>
main()
{
int n;
printf("Introduce un número entero\n");
scanf("%d", &n);
printf("Has introducido el número: %d", &n);
}