johnfdutcher
Programmer
Given a structure as below I tried to assign char array members of another structure to those in this one (as shown); the compiler returns:
"request for member 'seq_tray' in something not a structure or a union"
(repeated for each member assignment in the code below replacing 'seq_tray' with the appropriate member name on the 'left' of the assign attempt). I knew it couldn't be that simple....but thought arrays could be assigned to each other if of the same size ????
****** structure to be filled *******
struct item_struct {
int seq_tray;
char seq_lname[15];
char seq_fname[15];
char seq_minit;
char seq_recnbr[3];
char seq_regnbr[4];
};
struct item_struct table_item[300];
******** code lines ***************
table_item.seq_tray[cur_tbl] = found;
table_item.seq_lname[cur_tbl] = rec.last_name;
table_item.seq_fname[cur_tbl] = rec.first_name;
table_item.seq_minit[cur_tbl] = rec.mid_initial;
table_item.seq_recnbr[cur_tbl] = rec.recnbr;
table_item.seq_regnbr[cur_tbl] = rec.regnbr;
found is an integer; all other rec.xxxx 'members' are character arrays or single characters.
"request for member 'seq_tray' in something not a structure or a union"
(repeated for each member assignment in the code below replacing 'seq_tray' with the appropriate member name on the 'left' of the assign attempt). I knew it couldn't be that simple....but thought arrays could be assigned to each other if of the same size ????
****** structure to be filled *******
struct item_struct {
int seq_tray;
char seq_lname[15];
char seq_fname[15];
char seq_minit;
char seq_recnbr[3];
char seq_regnbr[4];
};
struct item_struct table_item[300];
******** code lines ***************
table_item.seq_tray[cur_tbl] = found;
table_item.seq_lname[cur_tbl] = rec.last_name;
table_item.seq_fname[cur_tbl] = rec.first_name;
table_item.seq_minit[cur_tbl] = rec.mid_initial;
table_item.seq_recnbr[cur_tbl] = rec.recnbr;
table_item.seq_regnbr[cur_tbl] = rec.regnbr;
found is an integer; all other rec.xxxx 'members' are character arrays or single characters.