#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]); // 1번과 3번 출력
    return 0;
}

void func(int *pa, int n){
    int i, temp;
    for (i=0; i<n/2; i++){
        temp= *(pa+i);         //pa 포인터의 i간격의 값을 temp에 저장
        pa[i]=pa[n-1-i];       //마지막 배열의 값을 첫 배열 장소에 저장
        pa[n-1-i]=temp;        //temp값을 다시 마지막 배열 장소에 저장
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: