Skip to content

Instantly share code, notes, and snippets.

@you74674
Last active December 27, 2017 09:17
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 you74674/c49ec9de9caac19b21532b0545b6c52a to your computer and use it in GitHub Desktop.
Save you74674/c49ec9de9caac19b21532b0545b6c52a to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include "allocate.h"
void read_array(int *a, int len)
{
for(int i=0; i<len; i++)
scanf("%d", &(a[i]));
}
void print_array(int *a, int len)
{
for(int i=0; i<len; i++)
printf("%d ", a[i]);
printf("\n");
}
int main()
{
int C;
scanf("%d", &C);
for(int c=0; c<C; c++)
{
int len;
int *a;
scanf("%d", &len);
a=allocate(len);
read_array(a, len);
print_array(a, len);
release(a);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment