응용문제 2 : 값의 Swap
This commit is contained in:
16
Practice_03/app03-2.c
Normal file
16
Practice_03/app03-2.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
int a, b;
|
||||
a = 2, b = 1;
|
||||
|
||||
printf("변경전 => a(%p) = %d, b(%p) = %d\n", &a, a, &b, b);
|
||||
|
||||
int c = a;
|
||||
a = b;
|
||||
b = c;
|
||||
|
||||
printf("변경후 => a(%p) = %d, b(%p) = %d\n", &a, a, &b, b);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user