3

有什么区别

typedef struct node *node_ref;
typedef char *cstring;
struct node {
  cstring string;
  node_ref link;
};

typedef struct node *node_ref;
struct node {
  char string;
  node_ref link;
};

我的程序编译良好,没有任何声明的警告,所以我不知道它有什么不同。

4

1 回答 1

4

您已将 a 定义cstringchar *在第一种情况下string是指向 a 的指针,char在第二种情况下它是单个char.

两者都是有效的代码,但含义非常不同。

于 2012-11-15T14:33:39.917 回答