Novice question about malloc and pointers

Greg Conway gregory at ritcsh.csh.rit.edu
Tue Apr 30 08:43:47 AEST 1991


In article <1139 at gtenmc.UUCP> csp at gtenmc.UUCP () writes:
>	    for ( i = 0 ; i < MAX ; i++ )
>	       str[i] = malloc(strlen(gets(buff)+1)),
>	       strcpy(str[i],buff);

My, my, my -- live on the edge, don't we?
Using malloc without checking the return value is risky, at best...

						- Greg

-- 
		Gregory Conway @ Computer Science House, RIT



More information about the Comp.lang.c mailing list