void swapint x int y void main int
- Slides: 40
void swap(int x, int y); void main() { int a=100, b = 200; printf(“a= %d b=%d (main()함수)n”, a, b); swap(a, b); printf(“a= %d b=%d (main()함수)n”, a, b); } void swap(int x, int y) <출력 결과는? > { int z; z = x; x = y; y = z; printf(“x= %d y= %d (swap 함수)n”, x, y); } 한국재활복지대학 21
void swap(int *x, int *y); void main() { int a=100, b = 200; printf(“a= %d b=%d (main()함수)n”, a, b); swap(&a, &b); printf(“a= %d b=%d (main()함수)n”, a, b); } void swap(int *x, int *y) <출력 결과는? > { int z; z = *x; *x = y; *y = z; printf(“x= %d y= %d (swap 함수)n”, *x, *y); } 한국재활복지대학 22
void main( ) { int p =10; int q = 50; swap(p, q); swap(&p, &q); } void swap(int x, int y) { int temp; temp = x; x = y; y = temp; } Call By Value void swap(int *x, int *y) { int temp; temp = *x; *x = *y; *y = temp; Call By Reference } 한국재활복지대학 23
void main( ) { int p =10; int q = 50; swap(p, q); printf(“…”); 변수 주소 값 p 0 x 10010 10 q 0 x 10014 50 } void swap(int x, int y) { int temp; temp = x; x = y; y = temp; } Printf를 하는 시점에서 변화 없음 x 0 x 50010 10 y 0 x 50014 50 temp 0 x 50018 10 한국재활복지대학 24
void main( ) { int p =10; int q = 50; swap(&p, &q); printf(“…”); 변수 주소 값 p 0 x 10010 10 ==> 50 q 0 x 10014 50 ==> 10 } void swap(int *x, int *y) { int temp; temp = *x; *x = *y; *y = temp; } Printf를 하는 시점에서 변화 x 0 x 50010 0 x 10010 y 0 x 50014 0 x 10014 temp 0 x 50018 10 한국재활복지대학 25
Stack 의 상태 x + recu(x-1) 10 + recu(9) 9 + recu(8) 8 + recu(7) 7 + recu(6) 6 + recu(5) 5 + recu(4) 4 + recu(3) 3 + recu(2) 2 + recu(1) recu (1) 1 한국재활복지대학 28
책 예제 실습(p. 185~p. 195) kbhit() 함수 실습(p. 185) (2) isalpha() 실습 (p. 187) (6) isspace() 실습 (p. 191) (9) tolower() 실습 (p. 194) (10) toupper() 실습 (p. 195) 한국재활복지대학 32
책 예제 실습(p. 196~p. 200) (11) (13) (14) (11) strcat() 실습 (p. 196) strcmp() 실습 (p. 198) strcpy() 실습 (p. 199) strlen() 실습 (p. 200) 한국재활복지대학 34
- Public void drawsquare(int x, int y, int len)
- Sum0
- Void main int main
- Void swap(int a int b)
- Int f(int n)
- Divideint
- Int max(int x int y)
- Interface calculator public int add(int a int b)
- Void main(void)
- Void main(void)
- Void main() int i j charval='j'
- Public static void main int args
- Int i=10
- Void main() int i j charval='j'
- 저장 유형 지정자
- Include
- Int main(int argc, char** argv)
- Int main int num 4
- Void setup e void loop
- Void* to int
- Void func(int num)
- Public void print
- Int ival char cval void *ptr
- Public void set
- Int.max
- Interface myinterface int foo(int x)
- Int factorial(int n)
- Arduino const int
- Class test public static void main
- #include stdio.h void main()
- Public static void main string args
- #include stdio.h void main()
- Public class x public static void main
- Mainstring
- #include stdio.h void main()
- Public static void main