Initializing a array after declaration

Posted by robUK on Stack Overflow See other posts from Stack Overflow or by robUK
Published on 2010-05-12T07:29:27Z Indexed on 2010/05/12 7:34 UTC
Read the original article Hit count: 147

Filed under:

Hello,

gcc 4.4.3 c89

I have the following code as a sample of what I am trying to do. I don't know the actual size of the array, until I enter the function. However, I don't think I can set the array size after I have declared it. I need it global as some other functions will need to access the device names.

Many thanks for any suggestions,

/* global */
char *devices_names[];

void fill_devices(size_t num_devices)
{
    devices_names[num_devices];

    /* start filling */
}

© Stack Overflow or respective owner

Related posts about c