Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!gatech!ncar!tank!uxc!uxc.cso.uiuc.edu!a.cs.uiuc.edu!s.cs.uiuc.edu!carroll From: carroll@s.cs.uiuc.edu Newsgroups: comp.lang.c Subject: Re: Abstract Data Types in C Message-ID: <207600004@s.cs.uiuc.edu> Date: 16 Oct 88 16:08:00 GMT References: <116@capshaw.UUCP> Lines: 16 Nf-ID: #R:capshaw.UUCP:116:s.cs.uiuc.edu:207600004:000:985 Nf-From: s.cs.uiuc.edu!carroll Oct 16 11:08:00 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@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