Skip to content

Instantly share code, notes, and snippets.

@winhtut
Last active October 25, 2018 15:46
Show Gist options
  • Save winhtut/1b05069ded228d86c9953d153569a80e to your computer and use it in GitHub Desktop.
Save winhtut/1b05069ded228d86c9953d153569a80e to your computer and use it in GitHub Desktop.
Lesson 11 Array Part 2
#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;
}
#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;
}
#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;
}
#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