Interview Questions

C is not C++. Typedef names are not automatically generated

C Interview Questions and Answers


(Continued from previous question...)

C is not C++. Typedef names are not automatically generated

Q: Why doesn't
struct x { ... };
x thestruct;

work?

A: C is not C++. Typedef names are not automatically generated for structure tags. Either declare structure instances using the struct keyword:
struct x thestruct;
or declare a typedef when you declare a structure:
typedef struct { ... } x;
x thestruct;

(Continued on next question...)

Other Interview Questions