Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

RE: [lpc2000] Re: C Code Error Help

2006-04-03 by Robert Adsett

At 06:55 PM 4/2/2006 -0600, Michael Anton wrote:
>Well, you really shouldn't try to pass the array.  Usually one would
>pass a pointer to the array.

int x( int y[]);

and

int x( int *y);

are substantially similar.  The first form allows some additional type 
checking and if the following form

int x(int y[3]);

is used then not only is the type checking stronger but some bounds 
checking is also possible.

However, the calling form is the same in all cases, the array degenerates 
to a pointer.  In order to pass an array by value it is necessary to 
encapsulate it in a structure.

Robert


" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.