Click here to Skip to main content
15,567,615 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: C++ Queue and Stacks Pin
David Crow22-Oct-17 18:02
David Crow22-Oct-17 18:02 
AnswerRe: C++ Queue and Stacks Pin
jschell23-Oct-17 8:30
jschell23-Oct-17 8:30 
QuestionFind out optimum volume for packing different boxes Pin
Member 1347639321-Oct-17 19:25
Member 1347639321-Oct-17 19:25 
AnswerRe: Find out optimum volume for packing different boxes Pin
Richard MacCutchan21-Oct-17 21:48
mveRichard MacCutchan21-Oct-17 21:48 
GeneralRe: Find out optimum volume for packing different boxes Pin
Sascha Lefèvre21-Oct-17 22:01
professionalSascha Lefèvre21-Oct-17 22:01 
AnswerRe: Find out optimum volume for packing different boxes Pin
CPallini22-Oct-17 6:07
mveCPallini22-Oct-17 6:07 
GeneralRe: Find out optimum volume for packing different boxes Pin
David Crow22-Oct-17 18:03
David Crow22-Oct-17 18:03 
QuestionCan I put a variable length array inside a struct somehow? Pin
arnold_w17-Oct-17 1:38
arnold_w17-Oct-17 1:38 
I am working with an embedded microcontroller (ARM) and I'm building with GCC. The following is fully possible for me to:
struct testStruct_s {
    int dummy;
    const char* string;
};

struct testStruct_s testStructArray[] = {
    {0, "Hello World"},
    {0, "Hello World Again"}
};

But why isn't the following possble?
struct testStruct_s {
    int dummy;
    int* array;
};

struct testStruct_s testStructArray[] = {
    {0, {0, 1, 2, 3}},
    {0, {0, 1, 2, 3, 4}}
};

Is there a workaround to achieve this? I do not want to specify the array values outside the struct so the following is not what I want:
int array1[] = {0, 1, 2, 3};
int array2[] = {0, 1, 2, 3, 4};

struct testStruct_s testStructArray[] = {
    {0, array1},
    {0, array2}
};


-- modified 17-Oct-17 7:50am.
AnswerRe: Can I put a variable length array inside a struct somehow? Pin
Peter_in_278017-Oct-17 1:57
professionalPeter_in_278017-Oct-17 1:57 
GeneralRe: Can I put a variable length array inside a struct somehow? Pin
arnold_w17-Oct-17 2:08
arnold_w17-Oct-17 2:08 
GeneralRe: Can I put a variable length array inside a struct somehow? Pin
Peter_in_278017-Oct-17 2:43
professionalPeter_in_278017-Oct-17 2:43 
AnswerRe: Can I put a variable length array inside a struct somehow? Pin
CPallini17-Oct-17 2:54
mveCPallini17-Oct-17 2:54 
GeneralRe: Can I put a variable length array inside a struct somehow? Pin
arnold_w17-Oct-17 3:02
arnold_w17-Oct-17 3:02 
GeneralRe: Can I put a variable length array inside a struct somehow? Pin
CPallini17-Oct-17 3:24
mveCPallini17-Oct-17 3:24 
GeneralRe: Can I put a variable length array inside a struct somehow? Pin
arnold_w17-Oct-17 3:46
arnold_w17-Oct-17 3:46 
GeneralRe: Can I put a variable length array inside a struct somehow? Pin
CPallini17-Oct-17 3:58
mveCPallini17-Oct-17 3:58 
GeneralRe: Can I put a variable length array inside a struct somehow? Pin
jschell17-Oct-17 8:06
jschell17-Oct-17 8:06 
GeneralRe: Can I put a variable length array inside a struct somehow? Pin
Richard MacCutchan17-Oct-17 5:50
mveRichard MacCutchan17-Oct-17 5:50 
GeneralRe: Can I put a variable length array inside a struct somehow? Pin
arnold_w17-Oct-17 9:26
arnold_w17-Oct-17 9:26 
GeneralRe: Can I put a variable length array inside a struct somehow? Pin
leon de boer17-Oct-17 17:30
leon de boer17-Oct-17 17:30 
AnswerRe: Can I put a variable length array inside a struct somehow? Pin
jschell17-Oct-17 8:20
jschell17-Oct-17 8:20 
GeneralRe: Can I put a variable length array inside a struct somehow? Pin
arnold_w17-Oct-17 9:33
arnold_w17-Oct-17 9:33 
Questioninet error Pin
Member 1346819116-Oct-17 6:22
Member 1346819116-Oct-17 6:22 
GeneralRe: inet error Pin
Richard MacCutchan16-Oct-17 6:35
mveRichard MacCutchan16-Oct-17 6:35 
QuestionMFC Activex Control Pin
RichardK15115-Oct-17 21:53
RichardK15115-Oct-17 21:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.