Last active
August 29, 2015 13:59
-
-
Save hydai/10892742 to your computer and use it in GitHub Desktop.
2-D array
This file contains 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 <cstdio> | |
void func2(int arr[10][10]) { | |
for (int i = 0; i < 10; i++) { | |
for (int j = 0; j < 10; j++) { | |
printf(" %03d", arr[i][j]); | |
} | |
printf("\n"); | |
} | |
} | |
void func(int arr[10][10]) { | |
for (int i = 0; i < 10; i++) { | |
for (int j = 0; j < 10; j++) { | |
printf(" %3d", arr[i][j]); | |
} | |
printf("\n"); | |
} | |
func2(arr); | |
} | |
int main(int argc, char *argv[]) | |
{ | |
int arr[10][10]; | |
for (int i = 0; i < 10; i++) { | |
for (int j = 0; j < 10; j++) { | |
arr[i][j] = i+j; | |
} | |
} | |
func(arr); | |
return 0; | |
} |
This file contains 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 <cstdio> | |
void func(int arr[10][10]) { | |
for (int i = 0; i < 10; i++) { | |
for (int j = 0; j < 10; j++) { | |
printf(" %3d", arr[i][j]); | |
} | |
printf("\n"); | |
} | |
} | |
int main(int argc, char *argv[]) | |
{ | |
int arr[10][10]; | |
for (int i = 0; i < 10; i++) { | |
for (int j = 0; j < 10; j++) { | |
arr[i][j] = i+j; | |
} | |
} | |
func(arr); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment