Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
devc不断返回错误的值 #包括 #包括 main() { int n; printf(“介绍un número entero”\n); scanf(“%d”和“&n”); printf(“已经介绍了el número:%d”、&n); }_C_Dev C++ - Fatal编程技术网

devc不断返回错误的值 #包括 #包括 main() { int n; printf(“介绍un número entero”\n); scanf(“%d”和“&n”); printf(“已经介绍了el número:%d”、&n); }

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

每次我运行这个C代码时,我都会得到6487628 for n,我已经一次又一次地卸载和安装了它,它一直在这样做,我不知道还能做什么。

你不想在printf()中使用&n,你想要的是n。您正在显示存储在

Typo:
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); 
}