再给二级指针赋值时,把一级指针的值拷贝给二级指针不报错,但是有问题,请问这儿是什么原因呢?指针数据类型是char型,谢谢
//进栈
int Push(SqList s,ElemType *e) {
if(s->top-s->base>=s->stackSize){
printf("tnt\n");
s->base=(ElemType **)realloc(s->base,(STACKINCREAMENT+STACK_INIT_SIZE)*sizeof(ElemType));
if(!s->base) exit(ERROR);
s->top=s->base+s->stackSize;
s->stackSize+=STACKINCREAMENT;
}
char ch[N];
int i;
*(s->top)=(ElemType *)malloc(STACK_INIT_SIZE*sizeof(ElemType));
for(i=0;e[i]!='\0';i++){
*(s->top)[i]=e[i];
// printf("%c ",*(s->top)[i]);
}
*(s->top)[i]='\0';
printf("e:%s\n",e);
printf("S:%s\n",*(s->top));
(s->top)++;
return OK;
}
初始化栈绝对没问题的,也分配空间了