I am assuming that this is the same problem you asked about before:
how to get specific element content in an array an store to another array ?[
^]
In which case what you are trying to store is the index to the elements, not the elements themselves (which would make no sense at all, since the new array would be all "1"s).
This isn't difficult, in fact it's almost certainly your homework - so I won't give you the code!
Implement this:
1) Create a new integer array, the same size as the input array. Call it "indexes".
2) Create an integer, call "nextIndex", set it to zero.
3) Use a for loop to run through all elements of your inputArray, which a loop variable called "i".
3.1) If input array element "i" is equal to the value you are looking for ("1" in your example), then store the value of "i" into "indexes" at element "nextIndex" and increment "nextIndex" by one.
4) After the loop, "nextIndex" is the number of values you found, and "indexes" contains the indexes to the values in the input array.
Give it a try. This isn't difficult! :laugh: