Skip to content

Instantly share code, notes, and snippets.

@qvil
Created August 26, 2018 11:01
Show Gist options
  • Save qvil/b8cb622ef11343ee639bc78d4c7f492c to your computer and use it in GitHub Desktop.
Save qvil/b8cb622ef11343ee639bc78d4c7f492c to your computer and use it in GitHub Desktop.
Teacher appointment exam 2017
#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