PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] Defining struct in header file
Date: Friday, 17 Apr 2020, 07:54:35


    > Message Posted By: Unknown
    >
    > Can we define our structs in our header file for the hash table instead of
    > just declaring them?

That would defeat the entire purpose of putting the code
in a separate module, which is to be able to replace the
hash table by another data structure (e.g., an AVL tree)
without rewriting the code.

An exception would be to define a triple in the header
file, to give insert() a triple rather than three
separate values, and to have search set a triple in the
calling program if it finds the key.
=====

    > I want to be able to access the fields of my struct in Nine20, but if I
    > define them in the implementation Hash.c then I won't be able to do so,
    > correct?

As noted above, accessing the fields of the struct defeats
the entire purpose of a separate module.

--Stan-
PREV INDEX NEXT