小编dyx*_*yxh的帖子

何时将指针作为参数传递给结构,何时将指针传递给指向结构的指针?

我的问题是关于以下代码.

#include <stdio.h>
#include <stdlib.h>

struct node
{
    int v;
    struct node * left;
    struct node * right;
};

typedef struct node Node;

struct bst
{
    Node * root;
};

typedef struct bst BST;

BST * bst_insert(BST * tree, int newValue);
Node * bst_insert_node(Node * node, int newValue);
void bst_traverseInOrder(BST * tree); 
void bst_traverseInOrderNode(Node * node);

int main(void)
{
    BST * t;

    bst_insert(t, 5);
    bst_insert(t, 8);
    bst_insert(t, 6);
    bst_insert(t, 3);
    bst_insert(t, 12);

    bst_traverseInOrder(t);

    return 0;
}

BST * bst_insert(BST * …
Run Code Online (Sandbox Code Playgroud)

c tree pointers arguments

1
推荐指数
1
解决办法
1334
查看次数

标签 统计

arguments ×1

c ×1

pointers ×1

tree ×1