Are these two the same in C programming language?
Solution 1:
In this declaration
struct{
int age;
float height;
}person1,*personPtr;
there are declared an unnamed structure an object of the structure type and a pointer to an object of the structure type.
You will be unable to refer the structure type in your program because it is unnamed.
These declarations
struct person{
int age;
float height;
};
struct person person1;
struct person *personPtr;
differ from the preceding declaration in the way as there is declared a named structure that can be referred in the program.
The code snippet would be equivalent if the first declaration will be rewritten like
struct person{
int age;
float height;
}person1,*personPtr;