C++
Programming and Technical
Programming
Program
What will be the output?
main()
{
int a[]={1,3,5,7};
printf("%d",&a[3]-&a[1]);
}
Options
1) 1
2) 2
3) 3
4) 4
Read Solution (Total 3)
-
- 2) 2
&a[i] = &a + i;
Hence, &a[3] - &a[1] = (&a + 3) - (&a + 1) = 2. - 7 years agoHelpfull: Yes(1) No(1)
- a[3]=7
a[1]=3
Ans =4 - 6 years agoHelpfull: Yes(1) No(0)
- value of a[3] is 7 and value of a[1] is 3. so 7-3 =4
- 7 years agoHelpfull: Yes(0) No(1)
C++ Other Question