Next Previous Contents

43. get_struct_field_value

Synopsis

Get the value associated with a structure field

Usage

x = get_struct_field_value (Struct_Type s, String field_name)

Description

The get_struct_field_value function the value of the field whose name is specified by field_name of the structure s.

Example

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

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

         names = get_struct_field_names (s);
         (dims,,) = array_info (names);
         num = dims[0];

         for (i = 0; i < num; i++)
           {
             name = names[i];
             value = get_struct_field_value (s, name);
             vmessage ("s.%s = %s\n", name, string(value));
           }
      }
See Also

get_struct_field_names, _push_struct_field_values, array_info


Next Previous Contents