3

what is the difference between

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

and

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

my program compiles fine with no warnings with either declaration, so I have no idea what difference it made.

JohnnyHK
  • 305,182
  • 66
  • 621
  • 471
paeynivek
  • 41
  • 2

1 Answers1

4

You've defined cstring as a char * so in the first case string is a pointer to a char and in the second case it's a single char.

Both valid code, but very different meanings.

JohnnyHK
  • 305,182
  • 66
  • 621
  • 471