The original idea behind a “structure” was that it would provide a logical grouping of data. You see “struct” was the new hoitytoity word for RECORD. BASIC provided us with a RECORD which, ironically, was used to declare a structure we would read and write to files. COBOL provided us the “01” level underneath the FD (File Descriptor) to contain the various record definitions which could be written to an indexed file. C desperately needed a word which could provide this logical grouping, but, there was a problem. C was a cheap language used to write an incredibly cheap operating system. That OS took massive shortcuts and adopted significant design flaws because it was never supposed to see the light of day in the business world.
Unix was supposed to be a single purpose platform which would allow task switching and remote access by technicians, but, its original design purpose was to only operate telephone switching stations. Such a single purpose coupled with the promise this would never be released commercially or require any support whatsoever outside of the company allowed horrific shortcuts to be taken with the OS design. To start with, it really doesn't have processes, it has threads, but, we discussed that in another book of this series. More importantly, the entire OS kernel was written without embedding the concept of a record as the primary logical IO unit. Yes, it supported blocks for physical IO, but there was no logical IO concept. The only builtin file storage concept was a stream. To this day this issue still causes massive multiuser headaches and disaster recovery problems. If someone hadn't finally written a relational database for first Unix, then Linux, neither operating system would be the least bit usable in the business world.
The first wart to appear in the C language due to this massive design flaw was the “struct” keyword. The powers that be did not want to point out such a massive design flaw at a time when 90% of all critical business data was still stored in either indexed files or on magnetic tape, in record format. Had they introduced the RECORD keyword the first thing the IT community would have said is “Great, how do I declare keys and connect this to a file for permanent storage?”
Colleges, who by now had copies of the operating system which wasn't supposed to see the light of day and the compiler for the language developed to only write that operating system, started teaching “Data Structures” courses. Students were required to ooh and aah at how you could create linked lists and doubly linked lists by embedding next and previous pointers inside of a data structure which was naturally implemented via the struct keyword. IT professionals once again said “Great, how do I declare keys and connect this to a file for permanent storage?”
Let me veer off a moment to explain what I meant when I said C was a “cheap” language. Those who know me know I have worked for decades using C, but it was and still is a cheap language.
C was designed to be “one level above assembly language” when it was originally implemented. The core language itself provides almost no functionality. What you believe to be the “core” language is a set of extension libraries and header files which have been added to the language and became part of the ANSI C standard at some point. The world's most famous C program, hello.c, doesn't even