What values will the msv array have:
int main()
{
	int msv[10];
	for(int i=0; i<10; ++i)
		i[msv] = i;
        return 0;
}
Explanation
i[msv] and msv[i] are the same as *(i+msv) and *(msv+i)
5.2.1 Subscripting
A postfix expression followed by an expression in square brackets is a postfix expression. One of the expressions shall have the type “pointer to T” and the other shall have enumeration or integral type. The result is an lvalue of type “T.” The type “T” shall be a completely-defined object type. The expression E1[E2] is identical (by definition) to *((E1)+(E2)).

Follow CodeGalaxy

Mobile Beta

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