Next Previous Contents

42. get_struct_field_names

Synopsis

Retrieve the field names associated with a structure

Usage

String_Type[] = get_struct_field_names (Struct_Type s)

Description

The get_struct_field_names function returns an array of strings whose elements specify the names of the fields of the struct s.

Example

The following example illustrates how the get_struct_field_names function may be used to print the value of a structure.

      define print_struct (s)
      {
         variable names, i, num;
         variable name, value;

         names = get_struct_field_names (s);

         % num values will be placed on stack by next call
         num = _push_struct_field_values (s);

         for (i = 0; i < num; i++)
           {
             name = names[i];
             value = ();

             vmessage ("s.%s = %s\n", name, string(value));
           }
      }
See Also

_push_struct_field_values, get_struct_field_value


Next Previous Contents