I have been learning about linked list. In an example, there is a piece of code that defines the ListNote struct like this:
1 2 3 4 5
|
struct ListNode
{
double value;
struct ListNode *next;
};
|
Why is there the word "struct" in the 4th line? Can it be:
1 2 3 4 5
|
struct ListNode
{
double value;
ListNode *next;
};
|
Last edited on
That is a hangup from C, C++ accepts your second example but C doesn't.
In C, the actual type is "struct ListNode"
The answer to your question is YES if its in (or included into) a .cpp file, NO if its in (or included into) a .c file.