| delorie.com/archives/browse.cgi | search |
| From: | Erik Max Francis <max AT alcyone DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Why won't this program run? |
| Date: | Fri, 06 Nov 1998 16:12:13 -0800 |
| Organization: | Alcyone Systems |
| Lines: | 22 |
| Message-ID: | <3643905D.6A062868@alcyone.com> |
| References: | <199811052339 DOT SAA21629 AT delorie DOT com> <36433596 DOT 445AFC73 AT utilicom DOT com> |
| NNTP-Posting-Host: | kamali.alcyone.com |
| Mime-Version: | 1.0 |
| X-Mailer: | Mozilla 3.01 (X11; I; Linux 2.0.30 i586) |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Steve Chapel wrote:
> int numlines=10;
> input=(char **)malloc(10);
>
> Shouldn't that be
> input = (char **)malloc(numlines * sizeof(char **));
> as written, your program allocates 10 bytes, not room for 10 char
> **'s.
An array of 10 char *s, not an array of 10 char **s.
input = (char **) malloc(numlines*sizeof(char *));
--
Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900
Alcyone Systems / irc maxxon (efnet) / finger max AT sade DOT alcyone DOT com
San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/
USA / icbm 37 20 07 N 121 53 38 W / &tSftDotIotE
\
/ Give me chastity, but not yet.
/ St. Augustine
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |