我已经声明了一个指向一组3-d数组的指针,我在下面分享过.我在使用指向3-d数组的指针访问3-d数组的元素时遇到了问题.
#include <stdio.h>
void main()
{
int m,row,col;
int *ptr,*j;
int array[2][5][2]={10,20,30,40,50,60,70,80,90,100,18,21,3,4,5,6,7,81,9,11};
int (*p)[5][2]; // pointer to an group of 3-d array
p=array;
for(m=0;m<2;m++)
{
ptr=p+m;
for(row=0;row<5;row++)
{
ptr=ptr+row;
for(col=0;col<2;col++)
{
printf("\n the vale is %d",*(ptr+col));
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
输出:
the value is 10
the value is 20
the value is 20
the value is 30
the value is 40
the value is 50
the value is 70
the value is 80
the value is 18
the value is …
Run Code Online (Sandbox Code Playgroud) 我是一名嵌入式软件工程师.我从未使用过诸如树,图表或链表之类的数据结构.我只用循环缓冲器,阵列等我很想知道在嵌入式系统中的数据结构的一部分是明确使用树,图,和链表.有没有具体的例子?
我遇到了以下"抽象数据类型"的定义,我无法理解.有人可以解释一下,最好是举个例子吗?
抽象数据类型定义为构成数据类型的数据对象的数学模型以及对这些对象进行操作的函数