Hello,
I have a question in regards to how do I make a function return value go to a specific record of a structure.
I have tried a few ways to do this but can't seem to see how to do it. Maybe i just can't see the obvious when it is in front of me
I now how to set records of a structure when in the main function but i have a specific return value of a function I want to set in the structure record.
as an example:
Code:
typedef struct
{
char name[21];
char city[21];
char state[3];
} Rec;
typedef Rec *RecPointer;
RecPointer r;
r = (RecPointer)malloc(sizeof(Rec));
strcpy((*r).name, "Leigh");
but what if I want the "Leigh" set to r->name from a seperate function?
Like this:
Code:
r->name = function()
I know it isn't the right way but am unsure on how to proceed with this.