Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Nov 1995 10:59:39 +0500
From:      Jerry.Kendall@vmicls.com (Jerry Kendall)
To:        freebsd-hackers@freebsd.org
Subject:   HELP with typedef
Message-ID:  <9511211559.AA27128.gonzo@vmicls.com>

next in thread | raw e-mail | index | archive | help
Hello all.

Don't know the name of a mailing list for 'C' hackers.
So, I sent it here. Can somebody tell me the name of a hackers
list for the 'C' language ???


I  need to create a subroutine that is passed a pointer to
an array of pointers to strings. ie: address of (char *list[]).

I need it to be a typedef as the routine called will handle lists
of different sizes. This is better than using variable args for
this task.

My co-workers and I are a little stumped. Included below is the
only solution I could come up with. BUT it does not compile.


Help of some form would be great.


Jerry.

-------------------------------
typedef char *[] StringList;


StringList List = {"one","two","three","four","END OF LIST",""};

PrintList( StringList *List)
{
	int x;

	for(x = 0; List[x] != 0; x++)
		printf("List entry %d: %s\n", List[x]);
}

main()
{
	PrintList(&List);
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9511211559.AA27128.gonzo>