Created
May 20, 2017 06:05
-
-
Save henryyang42/57a6464fa3b952d33cd30e2a4c1bc8eb to your computer and use it in GitHub Desktop.
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> | |
| #define MAX_N 10 | |
| #define MAX_M 10 | |
| void add_one(int s[MAX_N][MAX_M], int n, int m) { | |
| /* All elements in s will add one. */ | |
| int i, j; | |
| for(i = 0; i < n; i++) | |
| for(j = 0; j < m; j++) | |
| s[i][j] += 1; | |
| } | |
| int main() { | |
| int leo87[MAX_N][MAX_M] = {}; /* Initial all 0*/ | |
| int n = 8, m = 7; | |
| add_one(leo87, n, m); /* Only add one to 8x7 */ | |
| int i, j; | |
| for(i = 0; i < MAX_N; i++, putchar(10)) | |
| for(j = 0; j < MAX_N; j++) | |
| printf("%d ", leo87[i][j]); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment