What's the difference between
andCode:typedef struct // about this line
{
int val;
struct ll * next;
} ll;
? They both compile fine.Code:struct ll // about this line
{
int val;
struct ll * next;
} ll;
Printable View
What's the difference between
andCode:typedef struct // about this line
{
int val;
struct ll * next;
} ll;
? They both compile fine.Code:struct ll // about this line
{
int val;
struct ll * next;
} ll;
The first one creates an anonymous struct (without any name) and typedefs it to the type "ll".
The second one creates a struct called "ll" an initializes one struct called "ll".
The first one is equal to:
the second one is equal to:Code:struct someStruct {
int val;
struct ll * next;
};
typedef someStruct ll;
Code:struct ll // about this line
{
int val;
struct ll * next;
}
struct ll ll;