Skip to content

Commit 2ccd6ce

Browse files
authored
Add test files exercice mock interview
1 parent cda06d6 commit 2ccd6ce

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

8-main.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include "main.h"
2+
/**
3+
* main - check the code for
4+
*
5+
* Return: Always 0.
6+
*/
7+
int main(void)
8+
{
9+
int array[5];
10+
array[0] = 98;
11+
array[1] = 402;
12+
array[2] = -198;
13+
array[3] = 298;
14+
array[4] = -1024;
15+
print_array(array, 5);
16+
return (0);
17+
}
18+

8-print_array

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include<stdio.h>
2+
#include<stdlib.h>
3+
4+
/**
5+
* Write a fnction who printed N elements of an array
6+
** @array: pointer to the array
7+
* @size: size of the array
8+
* @n: number of elements to print
9+
*/
10+
void print_array(int *a, int n)
11+
{
12+
int i;
13+
14+
for (i = 0; i < n; i++)
15+
{
16+
printf("%d", a[i]);
17+
if (i < n - 1)
18+
printf(", ");
19+
}
20+
printf("\n");
21+
}

0 commit comments

Comments
 (0)