Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!ames!excelan!donp From: donp@na.excelan.com (don provan) Newsgroups: comp.lang.c Subject: Re: Turbo C large character array Keywords: TC, char, array, large, huge Message-ID: <1627@excelan.COM> Date: 31 Jul 90 19:27:41 GMT References: <1990Jul27.193520.4689@ux1.cso.uiuc.edu> <6819@ozdaltx.UUCP> Sender: news@excelan.COM Reply-To: donp@novell.com (don provan) Distribution: comp Organization: Novell, Inc., San Jose, California Lines: 18 In article manning@gap.caltech.edu (Evan Marshall Manning) writes: >doug@ozdaltx.UUCP (Doug Matlock) writes: >>x = (char **)malloc(num_rows*sizeof(char)); > ^^^^^^^^^^^^ try sizeof(char *)!!!! Actually, i prefer char **x; x = (char **)malloc( num_rows * sizeof *x ); Since the type of x has already been defined, why duplicate that information in the malloc? In general, i avoid sizeof(type), since there's almost always a specific example of type at hand, and normally it is in fact that specific example i want to know the size of, not the generic type. (And, of course, i'd *never* use a name like "x"...) don provan donp@novell.com