main
Peace 6 days ago
parent 66bcd2a9d8
commit e93647efdf
  1. 16
      basic/3_pointer.c

@ -0,0 +1,16 @@
#include <stdio.h>
int main()
{
int a = 10;
int *p = &a; // p는 a의 주소를 저장
// &: 변수의 주소
// *: 주소에 저장된 값
printf("Value of a: %d\n", a);
printf("Address of a: %p\n", (void*)&a); // void*: 일반 포인터
printf("Address of a: %x\n", p);
printf("Pointing value of p: %d\n", *p);
return 0;
}
Loading…
Cancel
Save