error code for pointers and 2-Dimensional arrays
hi,
This is the code for pointers and 2-Dimensional arrays : #include <stdio.h> main() { int s[5][2]={ {1235,56}, {1212,33}, {1434,80}, {1312,78} }; int i, j; for(i=0;i<=3;i++) printf(" Address of %d th 1-D array=%u\n",s[i],s[i]); } the output of this program suppose to be: Address of 0 th 1-D array=3221222672 Address of 1 th 1-D array=3221222680 Address of 2 th 1-D array=3221222688 Address of 3 th 1-D array=3221222696 but it is: Address of -1073744624 th 1-D array=3221222672 Address of -1073744616 th 1-D array=3221222680 Address of -1073744608 th 1-D array=3221222688 Address of -1073744600 th 1-D array=3221222696 plz point me where is the error. |
Change this:
Code:
printf(" Address of %d th 1-D array=%u\n", s[i],s[i]); Code:
printf(" Address of %d th 1-D array=%u\n", i, s[i][1]); |
All times are GMT -5. The time now is 07:48 PM. |