Last active
November 5, 2017 11:35
-
-
Save qvil/f53aedf29c3dd45fb4d469da81d49109 to your computer and use it in GitHub Desktop.
teacher-appointment-exam-2017.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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