Can anybody tell me when to use typedef in C? In the following code I get a warning by gcc
:
warning: useless storage class specifier in empty declaration
typedef struct node
{
int data;
struct node* forwardLink;
} ;
The syntax of typedef
is typedef <type> <name>
; it makes the type accessible through the name
. In this case, you've only specified a type
, and no name
, so your compiler complains.
You probably want
typedef struct node
{
int data;
struct node* forwardLink;
} node;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With