What is the output of this code? int arr[] = {2, 4, 6}; int x = (*arr + 1) * (*(arr + 1)); cout << x; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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;

30th Aug 2020, 2:55 PM
Bayzid
Bayzid - avatar
1 Answer
+ 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
30th Aug 2020, 3:04 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar