The simplest and most straightforward way to accomplish this would be to maintain two counts to track how many items you inserted into the b
and c
arrays. Note that you will have to do this anyway in order to know where to insert the next item.
For example, you might declare b_count
and c_count
variables and initialize them to zero. If the number is even you write the number to b[b_count]
and then add 1 to b_count
, and the same thing for c
and c_count
if the number is odd.
Then you loop from 0 up to (but not including) the count variable of whatever array you want to enumerate.
I have not written any code here as I suspect this is a homework question and I do not want to spoonfeed the OP complete and working code.