Skip to content

Instantly share code, notes, and snippets.

@WarrenTheRabbit
Created January 16, 2024 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WarrenTheRabbit/6d51ada06f621f7e398058b11e779c45 to your computer and use it in GitHub Desktop.
Save WarrenTheRabbit/6d51ada06f621f7e398058b11e779c45 to your computer and use it in GitHub Desktop.
The print array function provided for Holberton's "C - Sorting algorithms & Big O" project
#include <stdlib.h>
#include <stdio.h>
/**
* print_array - Prints an array of integers
*
* @array: The array to be printed
* @size: Number of elements in @array
*/
void print_array(const int *array, size_t size)
{
size_t i;
i = 0;
while (array && i < size)
{
if (i > 0)
printf(", ");
printf("%d", array[i]);
++i;
}
printf("\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment