edited by
904 views
3 votes
3 votes
Main () { 
int a [3] [4] = $\begin{pmatrix}
1&2&3&4 \\
5&6&7&8 \\
9&10&11&12 \\ 
\end{pmatrix}$ 
printf ("\n% u% u% u", a[0]+1, * (a[0] + 1), 
*(*(a + 0)+1)); 
}

What is the output of the above program? Assume array begin at address 10.                                                    

edited by

2 Answers

1 votes
1 votes
12, 2 , 2

first will print address of 1st row 2st column element  which is 10 +2= 12

second will print value at that address i.e. 2

Third is same as second i.e. different expression = 2
0 votes
0 votes
a[0]+1

Given code will skip 1 element of 2d array so it will print address of second which is 14.(Given a=10).

a[0]+1
Will print value at the address (a[0]+1) which 2.
*(a[0]+1)=*(*(a+0)+1)

Same as above Will print value at the address (a[0]+1) which 2.

SO output:14,2,2

Related questions

1 votes
1 votes
1 answer
1
set2018 asked Nov 4, 2017
364 views
0 votes
0 votes
1 answer
2
0 votes
0 votes
1 answer
3
shree asked Nov 22, 2014
519 views
What will be the second value printed by the program if parameter passing mechanism is call by reference?int b=10 //global begin procedure func(int x,int y) begin print(b...
0 votes
0 votes
1 answer
4
stblue asked Oct 18, 2017
768 views
#include <stdio.h>int main(){ int a[] = {50, 60, 10, 30, 40, 20 }; int *b[] = {a+3, a+4, a, a+2, a+1, a+5 }; int c = b; c++; printf("%u, %u, %u\n", c-b, *...