arrays of pointers - NOVICE QUESTION!( Be forwarned ! )

Ken Eglaston ken at laidbak.UUCP
Tue Jun 6 14:27:34 AEST 1989


In article <1170 at draken.nada.kth.se> d88-jwa at nada.kth.se (Jon W{tte) writes:
>>	 * malloc below is implicitly cast to (char **), but this
>>	 * depends on it returning (void *); old compilers need the
>>	 * cast, since malloc() returns (char *).  The same applies
>Hmmm. I thought that malloc() returned an unsigned long. At least
>it does on the Motorola compiler from 1982 I use, under Unix sys V
>for M68k-based machines. Can anyone who has more knowledge than me
>clarify this point ?
> __       Jon W{tte (The dread Smiley Shark) email:h+ at nada.kth.se
   According to the manual pages on most UNIX systems, malloc() is defined as:
	char *malloc(size)
	      unsigned size;
so a (char *) pointer to the chunk of memory asked for (if enough memory
exists) is returned, and you cast the pointer to whatever your need is.
    You might have mistaken the unsigned size for an unsigned long.....with
the constant revisions going on, it's not hard to get turned around! :>
-- 
Ken Eglaston   /!iexist!ken <- preferred -> FIDO: 115/777
UUCP:       att|!laidbak!ken                      115/108
               \!laidbak!laidy!ken



More information about the Comp.lang.c mailing list