C Programming - Structures, Unions, Enums - Discussion

Discussion Forum : Structures, Unions, Enums - Point Out Errors (Q.No. 2)
2.
Point out the error in the program?
typedef struct data mystruct;
struct data
{
    int x;
    mystruct *b;
};
Error: in structure declaration
Linker Error
No Error
None of above
Answer: Option
Explanation:
Here the type name mystruct is known at the point of declaring the structure, as it is already defined.
Discussion:
17 comments Page 2 of 2.

Krishna said:   1 decade ago
Please explain the typedef?

Coders said:   1 decade ago
typedef struct data mystruct;

Means we are making mystruct a member of struct at the time of declaration.

Shweta said:   1 decade ago
Why we use typedef and what is it's meaning?

Deepa.k.m said:   1 decade ago
Please tell the reason.

Amit kumar said:   1 decade ago
The typedef a simply definition of struct types which can be used for short name of structure definition.

Gowthami said:   1 decade ago
Hello please explain the line "typedef struct data mystruct;".

Satyaprakash said:   1 decade ago
Can anyone explain? why do you use typedef?


Post your comments here:

Your comments will be displayed after verification.