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.

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.