공부/C언어

21. *(int*) 응용

유저라인 2019. 7. 9. 15:39
728x90
반응형

main.c

#include <stdio.h>

void main(void) { 
 int test1 = 10; 
 int test2 = 0; 

 test2 = &test1; 
 *(int*)test2 = 23; 

 printf("test1=%d\r\n", test1); 
 printf("test2=0x%x\r\n", test2); 

}

*(int*) 을 통해서 다른 변수의 값에 영향을 줄수 있다.

 

결과화면

728x90
반응형