]> Skullheadx's Git Forge - qrcodescanner.git/commitdiff
2D array with printing
authorSkullheadx <admonty1@gmail.com>
Wed, 16 Oct 2024 01:33:46 +0000 (21:33 -0400)
committerSkullheadx <admonty1@gmail.com>
Wed, 16 Oct 2024 01:33:46 +0000 (21:33 -0400)
.gitignore [new file with mode: 0644]
main.cpp [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..874c63c
--- /dev/null
@@ -0,0 +1,2 @@
+*.o
+
diff --git a/main.cpp b/main.cpp
new file mode 100644 (file)
index 0000000..1227f52
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,30 @@
+#include <iostream>
+#define ROWS 4
+#define COLS 3
+
+
+void print(int (*image)[ROWS][COLS]);
+
+int main() {
+       int image[ROWS][COLS];
+
+       for (int i{0}; i < ROWS; ++i) {
+               for (int j{0}; j < COLS; ++j) {
+                       image[i][j] = 0;
+               }
+       }
+       
+       print(&image);
+               
+       return 0;
+}
+
+
+void print(int (*image)[ROWS][COLS]){ 
+       for (int i{0}; i < ROWS; ++i) {
+               for (int j{0}; j < COLS; ++j) {
+                       std::cout << (*image)[i][j];
+               }
+               std::cout << std::endl;
+       }
+}