My teatcher wants his students to go crazy using pointers and linked-structures. I dont mind studying it but im really stuck with this one and exam aproaches. I do understand the linked-structure graphycaly, but its a little hard to understand how to programm it.
I have a structure:
Code:
struct Book
{
char *pISBN;
char *pAutor;
char *pName;
int date;
};
Now, i have to make a data-structure that looks like the picture i uploaded. The RINGS mark as the books and the SQUARES mark as a new structure:
Code:
struct Header
{
struct Book *pBook;
struct Header *pNext;
};
In the first chain, there must be books whos author begins with a letter A, second chain in B and so on. If there is no author to some letter then ZERO must be added to the pointers vector. (like in the picture, there are no A-letter authors, no C-letter authors and more).
The function that creates this date-structure must be in prototype:
Code:
struct Header **CreateStructure(struct Book *pCollection ,int nNumber_of_books);
where nNumber_of_books is the number of books in vector "Collection" and pCollection is a pointer to the first book. Memory must be asked. i already have Collection[44] vector (44 books in vector).
Please someone help me to create this function and explaining the code as detailed as possible...