Problem with TURBO C and pointers

Ted H. Emigh emigh at ncsugn.ncsu.edu
Fri Jan 11 06:27:43 AEST 1991


In article <1991Jan9.012509.22427 at lingua.cltr.uq.OZ.AU> jcl at lingua.cltr.uq.OZ.AU (Jean-Claude Lacherez) writes:
>Thanks to all those who replied to my question concerning dynamic
>dimensioning of arrays.  Unfortunately the problem is not solved:
  The copy of his program follows:

>	#include <stdio.h>
>
>	#define	NB_OF_ROWS	5
>	#define	ROW_LENGTH	4

The problem is that he does not #include <stdlib.h>.  For the small model,
the pointer size is the same as the integer size.  For the large model, the
pointer size is larger than the integer size, but without the prototype it
will stuff the result of the malloc into an integer.

Moral:  Turn on all the checking features of TC (or Zortech or MSC or ..).
This would have been flagged immediately.



More information about the Comp.lang.c mailing list