Skip to content

Instantly share code, notes, and snippets.

@qvil
Last active November 5, 2017 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 qvil/f53aedf29c3dd45fb4d469da81d49109 to your computer and use it in GitHub Desktop.
Save qvil/f53aedf29c3dd45fb4d469da81d49109 to your computer and use it in GitHub Desktop.
teacher-appointment-exam-2017.c
#include <stdio.h>
#define SIZE 5
void func(int *, int);
int main(void)
{
int ary[SIZE] = {1, 7, 3, 9, 5};
func(ary, SIZE);
printf("%d %d", *(ary), ary[SIZE - 2]);
return 0;
}
void func(int *pa, int n)
{
int i, temp;
for (i = 0; i < n / 2; i++)
{
temp = *(pa + i);
pa[i] = pa[n - 1 - i];
pa[n - 1 - i] = temp;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment