C dereference an integer pointer in a structure

Viewed 990

I am having a problem correctly dereferencing a pointer to an integer that resides in an array of structures. The relevant parts of the code are:

typedef struct hf_register_info {
  int                   *p_id;  /**< written to by register() function */
  header_field_info     hfinfo; /**< the field info to be registered */
} hf_register_info;
.
.
hf_register_info hf[MAX_HF_COUNT];
.
.
*(hf[i].p_id) = -1;

The final line of code above causes an exception. How do I correctly deference p_id?

Thanks and regards...Paul

1 Answers
Related