+ 1
What is the output of this code? int arr[] = {2, 4, 6}; int x = (*arr + 1) * (*(arr + 1)); cout << x;
What is the output of this code? int arr[] = {2, 4, 6}; int x = (*arr + 1) * (*(arr + 1)); cout << x;
1 Réponse
+ 5
Always when you see, *arr it means arr[0] and when you see *(arr + n) which means arr[0+n]
so now solve it :
x = (arr[0] + 1) * (arr[0+1])
=> x = 3*4
Therefore x = 12