void input_ary(int *, int);
void print_ary(int *, int);
int main()
{
int ary[5] = { 10,20,30,40,50 };
int size = sizeof(ary) / sizeof(ary[0]);
print_ary(ary, 5);
input_ary(ary, size);
print_ary(ary, 5);
return 0;
}
void print_ary(int *ary, int a)
{
for (int i = 0; i < a; i++) {
printf("%d ", *(ary+i));
}
puts("");
puts("");
}
void input_ary(int *ary, int size)
{
int num;
for (int i = 0; i < size; i++) {
scanf("%d", &num);
*(ary + i) = num;
}
}
반응형