typedefing arrays

Alastair Dallas awd at dbase.UUCP
Sun Jun 11 06:54:19 AEST 1989


In article <17895 at mimsy.UUCP>, chris at mimsy.UUCP (Chris Torek) writes:
> In article <4636 at alvin.mcnc.org> spl at mcnc.org (Steve Lamont) writes:
> >  Is it possible to do something like
> >
> >	typedef int	vertex[3];
> >
> >Is this a sensible thing to do?
> 
> Yes.
> 

Of course it is.  For example, I like:

typedef char FNAME[<system-dependent size>];

Then you can have things like:

	func(FNAME name, int arg)
	{

		FNAME temp;

		strcpy(temp, name);
		if (temp[1] == ':')
			/* drive specified */
			;

		if (!strcmp(temp, name))
			;

	...and so on...

There are lots of good uses for typedef'd arrays.

/alastair/



More information about the Comp.lang.c mailing list