What will be the value of X after the execution of the code snippet:
int arr[] = { 1 , 2 };
int x = (arr[1] - arr[0]) [arr];
Explanation
First of all, the expression in parentheses will be executed by priority, and then X will be assigned the value of the array element arr[1]. Since arr[1] can be represented as * (arr + 1), it does not matter where is the index and where is the name of the array

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
C++ quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes