- 1
Write a c++ code to check and convert all negative values into positive in an array
with function
2 odpowiedzi
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
+ 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];
}
}
}