c - 引用数组 == 数组

标签 c arrays pointers reference

你能告诉我为什么引用的值 数组和数组本身的值是否具有相同的值?

我知道 a 是一种 int* 但对于 &a 它应该是 int** 还是我错了?? 所以这个值应该是一个指向 int 指针的指针。 示例代码:

    #include <stdio.h>

    int main()
    {
        int a[10];
        printf("a without ref.: 0x%x\n",a);
        printf("a with    ref.: 0x%x\n",&a);
        return 0;
    }

http://ideone.com/KClQJ

最佳答案

在这种情况下,数组名称衰减为指向其第一个元素的指针。

关于c - 引用数组 == 数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9311834/

相关文章:

valgrind 中的条件跳转或移动错误

java - 调整数组大小

ios - fatal error : unexpectedly found nil while unwrapping an Optional value when assigning a value from an array to a UILabel

c++ - 将常量 T* 常量转换为 T*

c++ - 指针参数和数组参数有区别吗?

c - 使用 mpz_set_str 初始化两个以上的 mpz_t 会导致段错误

c - 有什么方法可以区分规范模式下的 EOL 和 EOF 吗?

c - C中整数到 float 的转换

java.lang.ArrayIndexOutOfBoundsException : 9 error 异常

c++ - 类对象和指针的区别