Skip to content

Commit b2819d6

Browse files
committed
task 8
1 parent 9b6af65 commit b2819d6

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)