What's Wrong with this C Excert

Ray Wallace wallace at ynotme.enet.dec.com
Wed Aug 8 06:50:49 AEST 1990


In article <34877 at ut-emx.UUCP>, ezab066 at ut-emx.UUCP (Albert Wu) writes...
>The following is part of an example I saw on p.301 of Byron S.
>Gottfried's Schaum's Outline Series "Programming with C", copyrighted
>        *a = (int*) malloc (rows * ncols * sizeof(nt));
>        *b = (int*) malloc ( nrows * ncols * sizeof(int));
>        *c =(int*) malloc ( nrows * ncols * sizeof(int));
should be
        a = (int*) malloc (nrows * ncols * sizeof(int));
        b = (int*) malloc ( nrows * ncols * sizeof(int));
        c =(int*) malloc ( nrows * ncols * sizeof(int));
that is you need to remove the pointer prefix from in front of the variables
on the left side of the assignment statement.

---
Ray Wallace		
		(INTERNET,UUCP) wallace at oldtmr.enet.dec.com
		(UUCP)		...!decwrl!oldtmr.enet!wallace
		(INTERNET)	wallace%oldtmr.enet at decwrl.dec.com
---



More information about the Comp.lang.c mailing list