The code below is already completed using C++. Could you pleaseexplain why the input is
30
40
30
20. Please let me know the explanation.
#include <iostream>
#include <cstring>
using namespace std ;
int main()
{
int arr1[] = { 10 , 20, 30, 40 } ;
int* ptr1 ;
int index = 0 ;
ptr1 = arr1 ;
index++ ;
cout << *( ptr1 + ++index ) << endl ;
cout << *( arr1 + ++index ) << endl ;
cout << arr1[–index] << endl ;
cout << ptr1[–index] << endl ;
return ( 0 ) ;
}
Expert Answer
An answer will be send to you shortly. . . . .