I dont know how can i find out left neighbour.
this is the part of the task:
- The last product - as a used meaning for the predisposing elements of its arrays (left neighbor)
In line 21 you say: arr2[0]= arr1[i + 1] * 2; or arr2[0]= arr1[-858993460 + 1] * 2;. At least that is what I usually get for an uninitialized variable. "i" is uninitialized nor does it get a value before you use it. The compiler should have complained about that with at least a warning.
I am not sure if I follow what needs to be done, but I am thinking:
1 2 3
int i{}; // <--- Initializes to (0) zero.
arr2[0]= arr1[i + 1] * 2; // <--- Second element of the array.
arr2[9]=arr1[i] * 2; // <--- First element of the array or left neighbor. And why store in the last element of arr2?
With those changes and run in the shell program here the output is:
In line 21 is the first part of the task where i have to make -
The first element - like the double value of the second element of the first array (right neighbor) .
And in the line 22 i try to make the other part of the task.
Part of programming is being able to communicate effectively with other programmers, to know what the actual requirements are. I have a guess of what you're trying to do, but that's it.
Let's say SIZE = 3, and arr1[SIZE] = {2, 4, 5};
What do you want arr2's elements to become?
What should be printed to the screen?
Part of programming is being able to communicate effectively with other programmers, to know what the actual requirements are.
Instead of posting one line, which out of context is hard to understand, post ALL the instructions so everyone can try to understand what you are trying to do.
What you have - The last product. The last product of what? Is it two numbers from "arr1" and which 2?