home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!hobbes.physics.uiowa.edu!news.uiowa.edu!icaen!sbtaves
- From: sbtaves@icaen.uiowa.edu (Steven Bradley Taves)
- Subject: How to malloc an array of pointers?
- Message-ID: <1992Nov19.004950.9200@icaen.uiowa.edu>
- Sender: usenet@icaen.uiowa.edu (UseNet News daemon)
- Organization: Iowa Computer Aided Engineering Network, University of Iowa
- Distribution: usa
- Date: Thu, 19 Nov 1992 00:49:50 GMT
- Lines: 28
-
- Hi all,
-
- I'd appreciate it if someone could tell me how I can allocate memory
- for an array of pointers and for the strings they will be pointing to.
-
- I have
- char *Var[];
-
- Normally for
- char *Var;
- you do
- Var=(char *)malloc(10*sizeof(char));
- for a string of 10 characters.
-
- I want to allocate memory for 10 strings of ten characters. Also, how
- do I allocate memory for the pointers themselves?
-
- Thanks,
- Steve
-
-
- --
- ____________________________________________________________________
- "A boy he was tangled in his fight forever, a girl was missing
- two fingers","How do they kill children, and why do I wanna die"
- -Throwing Muses
- Got any news on The Breeders? Email me sbtaves@icaen.uiowa.edu
- --------------------------------------------------------------------
-