Passing arrays of strings

BillFrancis Michel bm at bike2work.Eng.Sun.COM
Thu Apr 4 11:04:34 AEST 1991


/* Help! I'm trying to intialize an array and pass it to a function,
   massage it.

   What's wrong with this picture?

   Thanks 

   Bill
*/
#include <stdio.h>

blop (instring, thearray)
char	*instring;
char	(*thearray)[];

{
	int	i;
		
	for (i=0; i<10; i++)
	  {
	  printf ("%s\n",thearray++);
	  }

}


main (argc, argv)

int		argc;
char	*argv[];

{
	char	myarray[10][ARRAY_LEN] ={{	"blop0"},
									{	"blop1"},
									{	"blop2"},
									{	"blop3"},
									{	"blop4"},
									{	"blop5"},
									{	"blop6"},
									{	"blop7"},
									{	"blop8"},
									{	"blop9"}};
	int		i;


	blop(argv[1], myarray);
}
--
Bill Michel			
bm at eng.sun.com		These views are my own, not Sun's.



More information about the Comp.unix.questions mailing list