posted by 코딩 공부중 2020. 1. 3. 15:54
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
 
void change(int *p, int n);
 
int main()
{
    int a[10] = {1,2,3,4,5,6,7,8,9,10};
    int i;
    change(a, 7);
    for(i=0; i<10; i++)
        printf("%d ", a[i]);
    puts(" ");
    return 0;
}
                    
void change(int *p, int n)
{
    int i;
    for(i=0; i<10; i++)
    {
        *(p+i) = *(p+i) + n;
    }
 }
 </stdio.h>

'c언어' 카테고리의 다른 글

행렬을 이용한 평균계산  (0) 2020.01.03
bubble sort  (0) 2020.01.03
구조체 사용 예제  (0) 2020.01.03
포인터 사용 예제  (0) 2020.01.03
RR(round-robin) 스케줄링 구현  (0) 2019.02.10