KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm stuck on understanding what's happening with this struct (from C for Programmers a Deitel book). The book says, "A structure cannot contain an instance of itself. For example, a variable of type struct employee cannot be declared in the definition for struct employee . A pointer to struct employee, however, may be included." It then gives the following example: struct employee2 { char firstName[ 20 ]; char lastName[ 20 ]; unsigned int age; struct employee2 *ePtr; }; I don't understand what this is doing, and I don't understand the reference to struct employee without the 2. How does struct employee2 *ePtr know about struct employee or am I off basis here?
Tags (comma-separated)
Save Edits
Cancel