+ 1

What's the result

Hello, programmers! Who ask me a little, why here is it 12 int arr[]={2,4,6}; int x=(*arr+1)*(*(arr+1)); cout<<x;

22nd Jul 2020, 6:43 PM
Vladimir Kushner
Vladimir Kushner - avatar
1 Odpowiedź
+ 1
arr is pointing to the first element of array... So , *arr is value at first position into array...arr + 1 will point to second element in array and hence * of (arr +1 ) is value at second position... With above, (2+1) * (4) would be 3*4 = 12 Hih
3rd Aug 2020, 4:24 PM
Ketan Lalcheta
Ketan Lalcheta - avatar