Abstract Data Types in C

carroll at s.cs.uiuc.edu carroll at s.cs.uiuc.edu
Mon Oct 17 02:08:00 AEST 1988


	I use Abstract Data Types all the time - they really are a bonus.
The key thing to remember is that C is *file* oriented - if you want data
to be shared among a set of functions, without access to the data from
other functions, all of the data sharing functions must be in the same
file. For instance, if we wanted a stack handler as an ADT, we would put
the stack variables in a file ("stack.c"), and make them 'static' - 
which for external variables means that they are not visible *outside the
file*. The stack handling routines go inside "stack.c" also, where they
can access the stack variables. Other code treats it as a black box, which
is linked in when needed. One of the main advantages of C++ is that it
more directly supports ADT's in programming.

Alan M. Carroll          "How many danger signs did you ignore?
carroll at s.cs.uiuc.edu     How many times had you heard it all before?" - AP&EW
CS Grad / U of Ill @ Urbana    ...{ucbvax,pur-ee,convex}!s.cs.uiuc.edu!carroll



More information about the Comp.lang.c mailing list