GFact | Use of struct keyword in C and C++
Last Updated :
17 Oct, 2023
In C, struct keyword must be used for declaring structure variables, but it is optional in C++.
For example, following program gives error in C and works in C++.
struct node {
int x;
node *next;
};
int main()
{
node a;
}
|
And following program works in both C and C++.
struct node {
int x;
struct node *next;
};
int main()
{
struct node a;
}
|
Share your thoughts in the comments
Please Login to comment...