Why is this printing 0, instead of 6?
main(void) {
   int i, j;
   int T[3][3] = {{5,1,3},{3,5,6},{5,6,3}};
   printf("%f", T[1][2]);
return 0;
}
Why is this printing 0, instead of 6?
main(void) {
   int i, j;
   int T[3][3] = {{5,1,3},{3,5,6},{5,6,3}};
   printf("%f", T[1][2]);
return 0;
}
 
    
    You invoked undefined behavior by passing printf() wrong type and you got the result by chance.
%f is for printing double, not int. To print int, you should use %d.
 
    
    it is not printing zero, in reality, it is returning 0, this happens whenever there is error.
the error to your code is that you used %f which is for printing double, since you have input in form of int, you need to use %d. this will solve the error and hence not return 0.
 
    
    