You can loop through the array. You can use an write-index within any loop. You can write each value not equal to zero to the current write index of the array. You can use ArrayResize to shrink the array. Combine these functionalities like each software developer.
Arpit T: How can i do that?
You write some code. Next time, show us your code and state the nature of your problem? Not compiled, not tested, just typed.
#define INDEX uint template<typename Ti, typename To> INDEX remove_copy(const Ti& inp[], INDEX iBeg, INDEX iEnd, To& out[], INDEX oBeg, const Ti& value){ for(; iBeg != iEnd; ++iBeg){ if(!(inp[iBeg] == value) ) out[oBeg++] = inp[iBeg]; } return oBeg; } ///////////// double index[]={0.0, 30.2, 458.2, 0.0, 0.0, 0.0} ArrayResize( index, remove_copy(index, 0, ArraySize(index), index, 0, 0.0) );Not compiled, not tested, just typed.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
My Array index[] has 5 values
0.0
0.0
458.2
30.2
0.0
I want to remove values which are 0.0
How can i do that?
Expecting result :
458.2
30.2