数据结构见多,,
大题嘛,一般就是树的遍历了。。
:什么是二叉平衡树,什么是树的后序遍历之类的,问我操作系统的分页机制
int *a[10];
int (*a)[10];
//问有什么区别......
int *a[10]
先找到声明符a,然后向右看,有[]说明a是个数组,再向左看,是int *,说明数组中的每个元素是int *。所以这是一个存放int指针的数组。
int(*a)[10]
先找到声明符a,被括号括着,先看括号内的(优先级高),然后向右看,没有,向左看,是*,说明s是个指针,什么指针?在看括号外面的,先向右看,有[]是个数组,说明a是个志向数组的指针,再向左看,是int,说明数组的每个元素是int。所以,这是一个指向存放int的数组的指针。
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
printf("=================================/n");
printf("==this program compare pointer ==/n");
int arr[3][4]={
{1, 2, 3, 4},
{11, 22, 33, 44},
{111,222,333,444}
};
int i,j;
/*a是一个指针变量,指向包含4个元素的一维数组*/
int (*a)[4];
/*b是一个指针数组*/
int *b[3];
printf("size of (*a)[4] =%d/n",sizeof a);
printf("size of *b[4] =%d/n",sizeof b);
a=arr;
for(i=0;i < 3; i++)
{
printf("/n arr[%i] =%i",i,arr[i]);
printf("/n a++ =%i",a++);
}
printf("/n===================/n");
printf("output value of arr[][] and *( *(a+i)+j ) /n/n");
system("PAUSE");
a=arr;
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
printf("/n arr[%i][%i] =%i",i,j,arr[i][j]);
printf("/n *(a+%i) =%i",i, *(a+i) );
printf("/n *(*(a+%i)+%i) =%i",i, j,*( *(a+i)+j ) );
}
}
printf("/n===================/n");
printf("now output value of b[] and *b[] /n/n");
system("PAUSE");
int anotherint_a = 8888;
int anotherint_b = 9999;
/*b为数组指针,每一项可以指向一个整数*/
b[0]=arr[0];
b[1]=&anotherint_a;
b[2]=&anotherint_b;
for(i=0;i<3;i++)
{
printf("/n the value of &b[%i] = %i",i,&b[i]);
printf("/n the value of b[%i] = %i",i,b[i]);
printf("/n the value of *b[%i]