struct people
{
    char * name;
    int  ages;
};
people * * person;
那么*person表示的是否是结构体的地址呢?person又是表示什么意思呢?

解决方案 »

  1.   

    *persion 便是结构体地址
    person 是一个指向这个地址的指针
      

  2.   

    **person是否就是一个结构体变量呢?
      

  3.   

    **person 表示一个结构体指针的指针people person  表示一个结构体变量
    people *person  表示一个结构体指针
    people * * person  表示一个结构体指针的指针
      

  4.   

    如果我要写一个堆栈。
    struct stack
    {
         people **top;   //**top or *top;
         people **bottom;//是*bottom还是**bottom;
    }
      

  5.   

    如果你要PUSH(),POP()people的地址就用你的写法.如果要入栈的是people则用*people.
      

  6.   

    struct BiTree
    {
    char data;
    BiTree *  lchild, *rchild;
    };
    struct stack
    {
    //BiTree var;
    BiTree * *top, * *bottom;
    };
    bool stackinit(stack s)
    {
    s.top=s.bottom=(BiTree * *)malloc(sizeof(BiTree *)*100);
    if(!s.top)
    return 0;
    return 1;
    }
    void push(stack s,BiTree * e)
    {
    * *(s.top)=*e;//运行到这里提示s.top没有初始化。可是在stackinit中不是已经初始化了吗?而且我是先运行stackinit(s)的呀!
    (s.top)++;
    }
    我在stackinit(s)里面加了
    *(s.top)=*(s.bottom)=(BiTree *)malloc(sizeof(BiTree *)*100);
    但是没有用!!!
      

  7.   

    试试:
    void push(stack s,BiTree * e)
    {
    * (s.top)=e;
    *(s.top)++;
    }
      

  8.   

    我把程序改了一下,#include <stdio.h>
    #include <stdlib.h>struct BiTree
    {
    char data;
    BiTree *  lchild, *rchild;
    };
    struct stack
    {
    //BiTree var;
    BiTree * *top, * *bottom;
    };
    bool stackinit(stack *s)
    {
    s->top=s->bottom=(BiTree * *)malloc(sizeof(BiTree * *)*100); if(!s->top)
    return 0;
    return 1;
    }
    void push(stack *s,BiTree * e)
    {
    *(s->top)=*(s->bottom)=(BiTree *)malloc(sizeof(BiTree *));
    *(*(s->top))=*e;
    (s->top)++;
    }
    struct BiTree * pop(stack *s)
    {
    return (*(s->top))--;
    }
    bool stackempty(stack *s)
    {
    if(s->top==s->bottom) return 1;
    return 0;
    }bool visit(int Node)
    {
    printf("%d",Node);
    return 1;
    }bool VisitBiTree(struct BiTree * p)
    {
       // BiTree *p=T;
    stack *s=(stack*)malloc(sizeof(stack));
    stackinit(s);
    push(s,p);
        while(p||!stackempty(s))
    {
    while(p)
    {
    visit(p->data);
    push(s,p);
    p=p->lchild;
    }
    if(!stackempty(s))
    {
    p=pop(s);
                p=p->rchild;);//在这里,死了。
    }
    }
    return 1;
    }
      

  9.   

    while(p)
    {
    visit(p->data);
    push(s,p);    //你保存的是指针.
    p=p->lchild;  //这里你又修改了指针.S里的最后一个数据实际是最左叶结点(没有L,可能有R)
    }         
    //这里执行过后.P指向最左的叶结点.它的L为NULL.R未知.if(!stackempty(s))
    {
    p=pop(s);      //得到最左叶结点.不知道有没有R?
             p=p->rchild;);//如果没有R,死了。
    }
      

  10.   

    有这么费事吗?bool stackinit(stack *s)
    {
    s->top=s->bottom=(BiTree * *)malloc(sizeof(BiTree *)*100); if(!s->top)
    return 0;
    return 1;
    }
    void push(stack *s,BiTree * e)
    {
    *(s->top)=e;
    (s->top)++;
    }/*
    *(s->top)=*(s->bottom)=(BiTree *)malloc(sizeof(BiTree *));
    这是干什么?你在堆栈里到底乡村什么?是数据还是地址?先能清楚!
    */
      

  11.   

    #include <stdio.h>
    #include <stdlib.h>struct BiTree
    {
    char data;
    BiTree *  lchild, *rchild;
    };
    struct stack
    {
    //BiTree var;
    BiTree * *top, * *bottom;
    };
    bool stackinit(stack *s)
    {
    s->top=s->bottom=(BiTree * *)malloc(sizeof(BiTree * *)*100); if(!s->top)
    return 0;
    return 1;
    }
    void push(stack *s,BiTree e)
    {
        *(s->top)=*(s->bottom)=(BiTree *)malloc(sizeof(BiTree *));
    *(*(s->top))=e;
    (s->top)++;
    }
    struct BiTree pop(stack *s)
    { return *(*(s->top))--;
    }
    bool stackempty(stack *s)
    {
    if(s->top==s->bottom) return 1;
    return 0;
    }bool visit(int Node)
    {
    printf("%d",Node);
    return 1;
    }bool VisitBiTree(struct BiTree * p)
    {
       // BiTree *p=T;
    stack *s=(stack*)malloc(sizeof(stack));
    stackinit(s);
    push(s,*p);
        while(*p||!stackempty(s))
    {
    while(*p)//结构体是不能这样判断的!!!
    {
    visit((*p).data);
    push(s,p);
    *p=(*p).lchild;
    }
    if(!stackempty(s))
    {
    *p=pop(s);
                *p=(*p).rchild;
    }
    }
    return 1;
    } int main(int argc,char * argv[])
    {
    struct BiTree * T=(BiTree *)malloc(sizeof(BiTree));
    T->data=1;
    T->lchild=(BiTree *)malloc(sizeof(BiTree));
    T->lchild->data=2;
    T->lchild->lchild=NULL;
    T->lchild->rchild=NULL;
    T->rchild =(BiTree *)malloc(sizeof(BiTree));
    T->rchild->data=3;
    T->rchild->lchild=NULL;
    T->rchild->rchild=NULL;    VisitBiTree(T);
    return 0;
    }
    到底应该怎么修改???
      

  12.   

    bool VisitBiTree(struct BiTree * p)
    {
       BiTree *pNode=p;    //表示当前指针
       stack *s=(stack*)malloc(sizeof(stack));
       stackinit(s);
       push(s,p);
       while(p||!stackempty(s))
      {
    while(p)
    {
    visit(p->data);
    push(s,p);
    pNode=p->lchild;
    }
    if(!stackempty(s))
    {
    pNode=pop(s);
                      p=pNode->rchild;);
    }
      }
    return 1;
    }
      

  13.   

    void push(stack *s,BiTree e)
    {
        *(s->top)=*(s->bottom)=(BiTree *)malloc(sizeof(BiTree *));
    *(*(s->top))=e;
    (s->top)++;
    }如果你想在堆栈中存数据:
    void push(stack *s,BiTree *e)
    {
        BiTree *pstNew;
          pstNew = (BiTree*)malloc(sizeof(BiTree));
        if ( !pstNew )
            return;
        *pstNew = *e;
        
    *(s->top)=pstNew;
    (s->top)++;
    }
    如果你想在堆栈中存数据address:
    void push(stack *s,BiTree *e)
    {
    *(s->top)=e;
    (s->top)++;
    }
    this program not decide the limit of 100 , and other,so it didn't finish,and don't know top should ++ or bottom ++, and 由于你没有保存你动态分配的首地址,所以思路就是错的。s->top=s->bottom=(BiTree * *)malloc(sizeof(BiTree * *)*100);top and bottom 总是在变,所以内存比丢。
      

  14.   

    sorry.上面的程序也不对.挺费脑的,让我想想.