我是编程新手,对数组有困难。我已经声明了数组,但是当我去打印数组的一个元素时,我得到了一个非常不同的数字(可能是内存地址?)。
#include <stdio.h>
int main()
{
int array[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
printf("%d", &array[3]);
return 0
}
然后它打印 6356748 而不是“3”。我做错了什么?
最佳答案
使用:
printf("%d", array[3]);
当你使用&variable
时,它返回变量的地址。
关于c - 在 C 中填充数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44105248/