|
|
|
@ -5,11 +5,47 @@ void addone(int n) |
|
|
|
|
n++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void addoneByRef(int* n) |
|
|
|
|
{ |
|
|
|
|
(*n)++;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
typedef struct |
|
|
|
|
{ |
|
|
|
|
int x; |
|
|
|
|
int y; |
|
|
|
|
} Point; |
|
|
|
|
|
|
|
|
|
void move1(Point* p) |
|
|
|
|
{ |
|
|
|
|
(*p).x++; |
|
|
|
|
(*p).y++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 약어
|
|
|
|
|
void move2(Point* p) |
|
|
|
|
{ |
|
|
|
|
p->x++; |
|
|
|
|
p->y++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int main() |
|
|
|
|
{ |
|
|
|
|
int n = 0; |
|
|
|
|
printf("Step0: %d\n", n); |
|
|
|
|
addone(n); |
|
|
|
|
printf("Step2: %d\n", n); |
|
|
|
|
addoneByRef(&n); |
|
|
|
|
printf("Step2: %d\n", n); |
|
|
|
|
|
|
|
|
|
printf("\n"); |
|
|
|
|
|
|
|
|
|
Point pt = { 1, 1 }; |
|
|
|
|
printf("Step0 pt.x: %d, pt.y: %d\n", pt.x, pt.y); |
|
|
|
|
move1(&pt); |
|
|
|
|
printf("Step1 pt.x: %d, pt.y: %d\n", pt.x, pt.y); |
|
|
|
|
move2(&pt); |
|
|
|
|
printf("Step2 pt.x: %d, pt.y: %d\n", pt.x, pt.y); |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |