decalring large arrays
Martin Gaeckler
Martin_Gaeckler at m.maus.de
Mon Jun 24 22:34:00 AEST 1991
Hi,
> void main ( void )
> {
> char *TheArray=(char *)malloc(BIG_NUMBER);
> char TheArrayAgain[]=TheArray; // Is this legal?
> }
No, it is NOT allowed to initialize an array with another array. The object
TheArrayAgain is in fact an array and not a POINTER, what you need. You have
to declare TheArrayAgain as char *TheArrayAgain = TheArray; and you may use
it like an array (what you probably want).
greetings from bavaria
Martin
More information about the Comp.lang.c
mailing list