[LUAU] Array size.

Jimen Ching jching at flex.com
Sat Apr 24 17:48:06 PDT 1999


On Sat, 24 Apr 1999, David & Max wrote:
>void main(void)
>{
>	int num_row;
> 	char *items[]={"hello",
>                      "Oops",
>                      "done"};
>       num_row =calcualte_array_size (items);
>}
>calculate_array_size is a function for calculating how many **rows** is in
>the string array items.  Anybody could tell me how to do that?

If you don't mind putting in a null string, you can just count the rows
until you find the null string at the end.

This may not be necessary.  If the array is always initialized like this,
the row size is known at compile time.

--jc
--
Jimen Ching (WH6BRR)      jching at flex.com     wh6brr at uhm.ampr.org

--
     __   __  __________  __
    / /  / / / / __  / / / /  Home Page: http://luau.hi.net
   / /__/ /_/ / /_/ / /_/ /
  /____/\____/_/ /_/\____/  LUAU - Linux Users AnonymoUs - Hawaii

   To unsubscribe: echo unsubscribe luau | mail majordomo at luau.hi.net
           LUAU meetings are the 3rd Tuesday of each month 6pm



More information about the LUAU mailing list