#include <stdio.h>
void printtest(int *p, int size);
int main(int argc, char* argv[]) {
    int a[5] = {10, 20, 30, 40, 50};
    int size = sizeof(a)/sizeof(a[0]); // size의 값은 5
    printtest(a, size/2);              //5/2는 정수로 반환하므로 2
    return 0;
}
void printtest(int *p, int size){
    printf("%d\n", p[size]);           //a배열의 두번째 30출력
    }

Embed on website

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