Reputation: 169
I found this structure in the slides of my professor:
struct point{
int x;
int y;
} p;
What does p mean? So far I used only the classical struct like this:
struct point{
int x;
int y;
};
Upvotes: 0
Views: 41
Reputation: 1
struct point{
int a;
int b;
}p;
This is the same as using struct point p
When we use typedef struct p as in
typedef struct point{
int a;
int b;
}p;
We can use p to declare a structure pointer or structure variable later on
To create a structure pointer p *abc
To create a structure variable p xyz
Upvotes: -1
Reputation: 67476
struct point{
int x;
int y;
} p;
defines a variable p
of type struct point
it is same as
struct point{
int x;
int y;
};
struct point p;
Upvotes: 3