Notice
Recent Posts
Recent Comments
Creative Code
pointer6.c(void 포인터) 본문
#include <stdio.h>
int main(void)
{
int i = 100;
double d = 3.14;
void *p;
p = &i;
*(int *)p = 200; // void 포인터의 역참조시에는 타입캐스팅을 해줘야한다.
printf("i :%d\n",i);
p = &d;
*(double *)p = 2.718;
printf("d : %f\n",d);
return 0;
}
'C Programming' 카테고리의 다른 글
lotto3.c(로또번호 추첨-100만번 섞기) (0) | 2023.08.03 |
---|---|
lotto2.c(로또 번호 추첨) (0) | 2023.08.03 |
pointer5.c(함수포인터) (0) | 2023.08.02 |
pointer4.c(이중포인터) (0) | 2023.08.02 |
pointer3.c(char형 포인터참조) (0) | 2023.08.02 |