Last active
October 25, 2018 15:46
-
-
Save winhtut/1b05069ded228d86c9953d153569a80e to your computer and use it in GitHub Desktop.
Lesson 11 Array Part 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<conio.h> | |
| int i, j; | |
| int row = 3; | |
| int col = 3; | |
| int main() { | |
| int a[3][3] = { {1,2,3}, {4,5,6}, {7,8,9}}; | |
| for (i = 0; i < row; i++) { | |
| for (j = 0; j < col; j++) | |
| { | |
| printf_s("%3d", a[i][j]); | |
| } | |
| printf_s("\n"); | |
| } | |
| _getch(); | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<conio.h> | |
| int main() { | |
| int i, j; | |
| int a[3][2] = { { 1, 4 }, | |
| { 5, 2 }, | |
| { 6, 5 } }; | |
| for (i = 0; i < 3; i++) { | |
| for (j = 0; j < 2; j++) { | |
| printf("%d ", a[i][j]); | |
| } | |
| printf("\n"); | |
| } | |
| _getch(); | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<conio.h> | |
| int main() { | |
| int i, j; | |
| int a[3][2] = { { 1 }, | |
| { 5, 2 }, | |
| { 6 } }; | |
| for (i = 0; i < 3; i++) { | |
| for (j = 0; j < 2; j++) { | |
| printf("%d ", a[i][j]); | |
| } | |
| printf("\n"); | |
| } | |
| _getch(); | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<conio.h> | |
| int main() { | |
| int arr[] = {10,11,12,13,14,15 }; | |
| int i; | |
| for (i = 0; i <= 5; i++) { | |
| printf("\n%d %d %d %d %d", arr,arr[i], *(i + arr), | |
| *(arr + i), i[arr]); | |
| } | |
| _getch(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment