From e93647efdf86ef784e8a103df514a721c5300e53 Mon Sep 17 00:00:00 2001 From: Peace Date: Thu, 24 Apr 2025 10:37:52 +0900 Subject: [PATCH] pointer --- basic/3_pointer.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 basic/3_pointer.c diff --git a/basic/3_pointer.c b/basic/3_pointer.c new file mode 100644 index 0000000..31bd39a --- /dev/null +++ b/basic/3_pointer.c @@ -0,0 +1,16 @@ +#include + +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; +} \ No newline at end of file