Files
2nd/10_Wiki/Dev/Topic_C/C_Pointers_Arrays.md
T
Antigravity Agent 1cfd3bbb56 docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고,
Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
2026-07-05 00:10:59 +09:00

4.0 KiB

id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
id title category status verification_status canonical_id aliases duplicate_of source_trust_level confidence_score created_at updated_at review_reason merge_history tags raw_sources applied_in github_commit
c-pointers-arrays C Pointers and Arrays Programming_Language draft conceptual
array name as pointer
array-pointer equivalence
C 포인터와 배열
B 0.87 2026-07-04 2026-07-04
c
programming-language
w3schools
pointers
arrays
https://www.w3schools.com/c/c_pointers_arrays.php

C Pointers and Arrays

🎯 한 줄 통찰 (One-line insight)

An array's NAME already IS a pointer to its first element — proven directly by printing myNumbers and &myNumbers[0] and getting the IDENTICAL address — meaning *myNumbers (dereferencing the bare array name) works exactly like myNumbers[0], and the entire array-indexing syntax arr[i] is really syntactic sugar over pointer arithmetic (*(arr + i)) that's been running underneath the whole time. [S1]

🧠 핵심 개념 (Core concepts)

  • Array name = pointer to first elementmyNumbers and &myNumbers[0] evaluate to the exact same address. [S1]
  • *arrayName — dereferences the array's implicit pointer to get the FIRST element's value, equivalent to arrayName[0]. [S1]
  • *(arrayName + i) — equivalent to arrayName[i]; offsetting the array-as-pointer by i and dereferencing reaches the same element as bracket indexing. [S1]
  • Mutation via dereference*myNumbers = 13; changes the first element just like myNumbers[0] = 13; would. [S1]
  • Element memory layout confirms the size math — consecutive int elements' addresses differ by exactly sizeof(int) (4 bytes), so an array of 4 ints occupies 16 bytes total. [S1]

📖 세부 내용 (Details)

  • Proving array-name-equals-pointer: printf("%p\n", myNumbers); printf("%p\n", &myNumbers[0]); // identical addresses. [S1]
  • Dereferencing the bare array name for the first element: printf("%d", *myNumbers); // 25 (same as myNumbers[0]). [S1]
  • Offsetting to reach later elements: printf("%d\n", *(myNumbers + 1)); // 50 printf("%d", *(myNumbers + 2)); // 75. [S1]
  • Mutating through dereference: *myNumbers = 13; *(myNumbers + 1) = 17; changes the first and second elements. [S1]

⚖️ 모순 및 업데이트 (Contradictions & updates)

  • 배열 이름은 이미 포인터: 배열 이름을 그대로 출력한 주소와 &배열[0]으로 얻은 주소가 완전히 동일하다는 점이 직접 증명되며, 이는 배열 인덱싱(arr[i])이 실제로는 포인터 연산(*(arr+i))의 편의 문법임을 시사함. [S1]

🛠️ 적용 사례 (Applied in summary)

대용량 배열이나 2차원 배열, 그리고 배열인 문자열(string)에 접근할 때 포인터 방식이 더 효율적이고 빠르다는 점이 원문에서 직접 언급됨. [S1]

💻 코드 패턴 (Code patterns)

An array's name and the address of its first element are identical (C):

int myNumbers[4] = {25, 50, 75, 100};
printf("%p\n", myNumbers);       // e.g. 0x7ffe70f9d8f0
printf("%p\n", &myNumbers[0]);   // same address: 0x7ffe70f9d8f0
printf("%d", *myNumbers);        // 25, same as myNumbers[0]

검증 상태 및 신뢰도

  • 상태: draft
  • 검증 단계: conceptual
  • 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
  • 신뢰 점수: 0.87
  • 중복 검사 결과: 신규 생성 (New discovery)

🔗 지식 그래프 (Knowledge Graph)

📚 출처 (Sources)

📝 변경 이력 (Change history)

  • 2026-07-04: Initial draft synthesized from the W3Schools "C Pointers and Arrays" page (Astra wiki-curation, P-Reinforce v3.1 format).