What generally happens when you have complex models that require many dimensions is that the problem gets split into other data structures.
if we take Salem's example:
Code:
char library[BOOKS][CHAPTERS][PARAGRAPHS][SENTENCES][WORDS][CHARS];
Not only does this cause problems with the fact that ALL books will have CHARS characters, representing the longest word used in any book of the library. The number of words in a sentence in a law-book may be quite different from that of a childrens book, for example.
This all means that it's probably not a feasible structure.
A more dynamic structure, where data is stored "as needed" will solve this problem:
Code:
struct word
{
char *chars;
};
struct sentence
{
int num_words;
struct word *words;
};
struct paragraph
{
int num_sentences;
struct sentence *sentences;
};
Then we allocate dynamically the NECESSARY content, setting the num_words according to the current length of the sentences, so "Bob plays with a toy." takes up 5 words, whilst "The hirer of aforementioned vehicle will at all times ensure that the necessary and required maintenance and service is performed according to the manufacturers instructions, and any cost for such maintenance or servicing is to be paid by the hirer." takes up 39 words in it's sentence.
--
Mats