引用二维数组 [英] dreferencing 2 d array

查看:27
本文介绍了引用二维数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请看这段代码:-

#include<stdio.h>
int main()
{
int arr[2][2]={1,2,3,4};
printf("%d %u %u",**arr,*arr,arr);
return 0;
}

当我编译并执行这个程序时,我得到了相同的 arr 和 *arr 值,这是 2 d 数组的起始地址.例如:- 1 3214506 3214506

When i compiled and executed this program i got same value for arr and *arr which is the starting address of the 2 d array. For example:- 1 3214506 3214506

我的问题是为什么取消引用 arr ( *arr ) 不会打印存储在包含在 arr 中的地址的值?

My question is why does dereferencing arr ( *arr ) does not print the value stored at the address contained in arr ?

推荐答案

*arr 是长度为 2 的整型数组,因此它与 arr 共享相同的地址.它们都指向数组的开头,也就是相同的位置.

*arr is type integer array of length 2, so it shares the same address as arr. They both point to the beginning of their arrays, which is the same location.

这篇关于引用二维数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆