Created
December 4, 2019 19:02
-
-
Save fenske/0c5dc17ee02ea89b90ecf0eb631c49ca to your computer and use it in GitHub Desktop.
Revisions
-
fenske created this gist
Dec 4, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ #include <iostream> using namespace std; #define N 4 void f(int A[N][N], int B[N]); int main() { int A[N][N] = { {1, 2, 3, 4}, {1, 2, 3, 4}, {1, 2, 3, 4}, {0, 2, 0, 4} }; int B[N] = {1, 1, 1, 1}; f(A, B); for (int i = 0; i < N; i++) { cout << B[i] << " "; } } void f(int A[N][N], int B[N]) { for (int j = 0; j < N; j++) { for (int i = 0; i < N; i++) { if (A[i][j] == 0) { B[j] = 0; break; } } } }