0

In the context of this question, I came up with the following code

typedef char Tuple[2];

Tuple test1[2] = {{1,2},{1,2}};
Tuple test2[3] = {{1,2},{1,2},{1,2}};
Tuple test3[4] = {{1,2},{1,2},{1,2},{1,5}};

Tuple* all[3]  = {test1, test2, test3};

to store pointers to arrays of arrays (2-tuples) in an initialized list. However, I failed to write equivalent code without using a typedef. What would the correct syntax for this look like?

1 Answer 1

1
char test1[2][2] = {{1, 2}, {1, 2}};
char test2[3][2] = {{1, 2}, {1, 2}, {1, 2}};
char test3[4][2] = {{1, 2}, {1, 2}, {1, 2}, {1, 5}};

char (*all[3])[2] = {test1, test2, test3};

Keep the typedef.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.