2

I hava an array with two types, which the odd index is always TypeA and the even index is always TypeB.

According to the description, the array always has even length, never have odd length.

The data structure of array must be so.

And this structure is from marijnh's orderedmap module.

// array
[A, B, A, B, A, B, ...]

// How to define it's type?
8

1 Answer 1

0

for this type of array it's better to define two arrays first for the first type and second for the second type but for example if it is char and int you can define it as a int and whenever you want to use it as a char in scanf use %d to scan ascii code of that and use %c in printf to print char of it

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.