C Nested Structure Pointer Problem

Posted by Halo on Stack Overflow See other posts from Stack Overflow or by Halo
Published on 2010-04-03T11:26:37Z Indexed on 2010/04/03 11:33 UTC
Read the original article Hit count: 296

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about c

    Related posts about structure