- 1

Write a c++ code to check and convert all negative values into positive in an array

with function

29th Mar 2018, 8:52 AM
Manisha Seth
Manisha Seth - avatar
2 Answers
0
you send an array to a funcion and a size of the array. ofc you can check the size within the function and then ignore the size argument
29th Mar 2018, 9:31 AM
Paul
+ 2
void ArrayToAbsolute(int* value_array, int size) { for(int i = 0; i < size; i++) { if(value_array[i] < 0) { value_array[i] = -value_array[i]; } } }
29th Mar 2018, 9:30 AM
Paul