本文介绍了数组int(* ptr)[10]的指针是什么,它是如何工作的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
int (*ptr)[10];
我期望 ptr 是一个由 10 个整数组成的指针数组.
I was expecting ptr to be an array of pointers of 10 integers.
我不明白它是如何指向 10 整数数组的指针.
I'm not understanding how it is a pointer to an array of 10 integers.
推荐答案ptr 类型为指向10个整数的数组的指针".在您的声明中,它是未初始化的,因此它不会指向任何对象.使其指向数组:
ptr is of type "pointer to array of 10 int". In your declaration it is uninitialized so it doesn't point to any object. To make it point to an array:
int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; // initialize in the declaration: int (*ptr) [10] = &arr; // or after: int (*ptr) [10]; ptr = &arr;更多推荐
数组int(* ptr)[10]的指针是什么,它是如何工作的?
发布评论