Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 06 / printArray.cpp
diff options
context:
space:
mode:
1 files changed, 18 insertions, 0 deletions
-rw-r--r--Sem. 06/printArray.cpp18
diff --git a/Sem. 06/printArray.cpp b/Sem. 06/printArray.cpp
new file mode 100644
index 0000000..af69b41
--- /dev/null
+++ b/Sem. 06/printArray.cpp
@@ -0,0 +1,18 @@
+#include <iostream>
+using namespace std;
+
+
+void print(const int arr[], unsigned int len)
+{
+ cout << "[ ";
+ for (int i = 0; i < len; i++)
+ cout << arr[i] << " ";
+ cout << "]" << endl;
+}
+
+int main()
+{
+ int arr[] { 1, 2, 3, 4, 5, 6, 7, 8};
+ print(arr, 8);
+}
+