I have this:
typedef struct nodebase{
char name[254];
char sex;
int clientnum;
int cellphone;
struct nodebase *next;
struct nodebase *encoding;
} clientdata;
I have added clientdata *curr[];
in seperate function. The reason why I made *curr
into *curr[]
instead is that this client data will be stored in a .txt
file. So I came up with singly linked-list to read all the data and when the program fscanf
every 5th variable, I will add 1 to clientcounter
.
So, the *curr[]
will be *curr[clientcounter]
.
Now, I need to convert this pointer array into char array named temp[clientcounter]
because char array is needed to evaluate something else later in the code.
I came up with this code below:(Using Tiny C on Windows)
void loaded_data_transfer(clientdata *curr,clientdata temp[],int clientcounter)
{
clientdata temp[] = {0};
temp[clientcounter].name = curr[clientcounter]->name;
temp[clientcounter].sex = curr[clientcounter]->sex;
temp[clientcounter].clientnum = curr[clientcounter]->clientnum;
temp[clientcounter].cellphone = curr[clientcounter]->cellphone;
}
The problem is, Tiny C is giving me an error: lvalue expected
at temp[clientcounter.name = ...
part. Can anyone tell me what did I do wrong?
And if anyone knows a better way to keep track of the curr
of clientdata by using counter and by using singly linked-list, please let me know.