Why use typedef struct instead of simply struct

Hi, I can not see the difference in:
1
2
3
4
typedef struct
{
	float x,y;
} Vector;


1
2
3
4
typedef struct Vector
{
	float x,y;
} ;


And

1
2
3
4
struct Vector
{
	float x, y;
} ;



Is there a reason to use one over another? They all seem to do precisely the same thing.
The first is often used in C so that you can refer to the struct without having to prefix the name with "struct". I don't think the second is legal. The third is used when you don't care about/mind putting "struct" in front of the name of the structure or in C++, where it automatically makes a typedef for you.
+1 Zhuge.

The typedef thing is a weird C thing. You don't have to do it in C++.
Topic archived. No new replies allowed.