Consider the two statements and find the difference between them?
struct sStudentInfo
{
char Name[12];
int Age;
float Weight;
int RollNumber;
};
#define STUDENT_INFO struct sStudentInfo*
typedef struct sStudentInfo* studentInfo;
statement 1
STUDENT_INFO p1, p2;
statement 2
studentInfo q1, q2;
Answer:
Both statements looking the same but actually, both are different from each other.
Statement 1 will be expanded to struct sStudentInfo * p1, p2. It means that p1 is a pointer to struct sStudentInfo but p2 is a variable of struct sStudentInfo.
In statement 2, both q1 and q2 will be a pointer to struct sStudentInfo.
need an explanation for this answer? contact us directly to get an explanation for this answer