Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!csd4.milw.wisc.edu!leah!albanycs!crdgw1!uunet!murtoa.cs.mu.oz.au!munnari.oz.au!uqcspe!batserver!anthony From: anthony@batserver.cs.uq.oz (Anthony Lee) Newsgroups: comp.lang.c++ Subject: Classes and Subclases at a Uni e.g. in Wiener and Pinson Keywords: static char, malloc Message-ID: <830@batserver.cs.uq.oz> Date: 16 Jun 89 06:50:14 GMT Sender: news@batserver.cs.uq.oz Reply-To: anthony@batserver.cs.uq.oz Lines: 48 On page 136 of "An Intrdouction to Object-Oriented Programming and C++" by Wiener and Pinson there is a function definition that looks like this: static char *strsave(char* s) // Why static char * ???? { char *p; extern char *malloc(); // Why ???? p = new char[ strlen(s) + 1]; strcpy(p, s); return( p ); } class data_rec { private: char* last_name; . . . public: data_rec(); void insert_last(char* ln); { last_name = strsave( ln ); } } . . . . class student : public data_rec { private: . . . My question is why strsave have to return a static char pointer ? And what's the extern char *malloc() declaration for ? Thanks in advance Anthony Anthony Lee (Humble PhD student) (alias Doctor(Time Lord)) ACSnet: anthony@batserver.cs.uq.oz TEL: (07) 3712651 (07) 3774139 (w) SNAIL: 243 Carmody Rd, St Lucia, 4067 Australia