We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9b6af65 commit b2819d6Copy full SHA for b2819d6
1 file changed
0x05-pointers_arrays_strings/8-print_array.c
@@ -0,0 +1,22 @@
1
+#include "main.h"
2
+
3
+/**
4
+ * print_array - a function that prints n elements of an array
5
+ * @a: array name
6
+ * @n: is the number of elements OF the array to be printed
7
+ * Return: a and n inputs
8
+ */
9
+void print_array(int *a, int n)
10
+{
11
+ int i;
12
13
+ for (i = 0; i < (n - 1); i++)
14
+ {
15
+ printf("%d, ", a[i]);
16
+ }
17
+ if (i == (n - 1))
18
19
+ printf("%d", a[n - 1]);
20
21
+ printf("\n");
22
+}
0 commit comments