C Nested Structure Pointer Problem
- by Halo
I have a shared structure, and inside it a request structure:
struct shared_data {
pthread_mutex_t th_mutex_queue;
struct request_queue {
int min;
int max;
char d_name[DIR_SIZE];
pid_t pid;
int t_index;
} request_queue[BUFSIZE];
int count;
int data_buffer_allocation[BUFSIZE];
int data_buffers[BUFSIZE][100];
};
Then I prepare a request;
struct shared_data *sdata_ptr;
...
...
sdata_ptr->request_queue[index].pid = pid;
strcpy(sdata_ptr->request_queue[index].d_name, dir_path_name);
sdata_ptr->request_queue[index].min = min;
sdata_ptr->request_queue[index].max = max;
And the compiler warns me that I'm doing an incompatible implicit declaration in the strcpy function. I guess that's a problem with the pointers, but isn't what I wrote above supposed to be true?