Free tutorials in Hindi & English Daily computer, mobile and IT guides Beginner friendly learning
Blog · C Pointers · 03 Jul 2026 · Hindi + English

Difference Between Array and Pointer in C (With Table)

Arrays and pointers look similar but differ in sizeof, assignment, memory and behaviour. Full comparison table plus the famous sizeof proof program.

Why the confusion exists

Arrays and pointers feel identical because in most expressions an array name decays into a pointer to its first element: arr becomes &arr[0], and arr[i] equals *(arr + i). But an array is not a pointer — and 4 differences prove it.

Difference 1: sizeof (the famous proof)

#include <stdio.h>

int main() {
    int arr[5] = {1, 2, 3, 4, 5};
    int *p = arr;

    printf("sizeof(arr) = %zu\n", sizeof(arr));  /* 20: whole array   */
    printf("sizeof(p)   = %zu\n", sizeof(p));    /* 8: just a pointer */
    return 0;
}
sizeof(arr) = 20 sizeof(p) = 8

sizeof sees the truth: arr is a 20-byte block of 5 ints; p is an 8-byte address holder. If arrays were pointers, both would print 8.

Difference 2: Assignment

int arr[5], brr[5];
int *p, *q;

p = q;        /* OK: pointers can be reassigned         */
p = arr;      /* OK: array decays to pointer            */
arr = brr;    /* ERROR: array name is not modifiable    */
arr++;        /* ERROR: cannot move an array            */

A pointer is a variable — it can point anywhere, any time. An array name is a fixed label for a fixed block of memory; it can never be reassigned or incremented.

Difference 3: Memory

  • Array: one allocation — the elements themselves. There is no separate "arr variable" storing an address.
  • Pointer: its own memory (8 bytes) that stores an address, separate from whatever it points to.

Difference 4: Behaviour with strings

char arr[] = "hello";   /* modifiable copy in the array   */
char *p    = "hello";   /* points to read-only literal    */

arr[0] = 'H';           /* OK                             */
p[0]   = 'H';           /* CRASH: undefined behaviour     */
This is the most practical difference and a top interview trap: string literals live in read-only memory, so writing through a char* to a literal crashes, while a char array holds its own writable copy.

Complete comparison table

PointArrayPointer
sizeofTotal bytes of all elementsSize of an address (4/8 bytes)
ReassignmentImpossibleAny time
arr++ / p++ErrorValid
MemoryBlock of elements onlySeparate 8-byte address holder
&nameAddress of whole array (int (*)[5])Address of the pointer variable
String literal initWritable copyRead-only reference

Confusion क्यों होता है

Arrays और pointers identical लगते हैं क्योंकि ज़्यादातर expressions में array name अपने पहले element के pointer में decay हो जाता है: arr बन जाता है &arr[0], और arr[i] = *(arr + i). लेकिन array pointer नहीं है — और 4 अंतर इसे prove करते हैं.

अंतर 1: sizeof (famous proof)

#include <stdio.h>

int main() {
    int arr[5] = {1, 2, 3, 4, 5};
    int *p = arr;

    printf("sizeof(arr) = %zu\n", sizeof(arr));  /* 20: पूरा array    */
    printf("sizeof(p)   = %zu\n", sizeof(p));    /* 8: सिर्फ pointer  */
    return 0;
}
sizeof(arr) = 20 sizeof(p) = 8

sizeof सच दिखाता है: arr पांच ints का 20-byte block है; p आठ-byte का address holder. अगर arrays pointers होते, तो दोनों 8 print करते.

अंतर 2: Assignment

int arr[5], brr[5];
int *p, *q;

p = q;        /* OK: pointers reassign हो सकते हैं       */
p = arr;      /* OK: array pointer में decay होता है     */
arr = brr;    /* ERROR: array name modifiable नहीं है    */
arr++;        /* ERROR: array को move नहीं कर सकते       */

Pointer एक variable है — कभी भी, कहीं भी point कर सकता है. Array name memory के fixed block का fixed label है; कभी reassign या increment नहीं हो सकता.

अंतर 3: Memory

  • Array: एक allocation — खुद elements. कोई अलग "arr variable" नहीं जो address store करे.
  • Pointer: अपनी memory (8 bytes) जो address store करती है, उससे अलग जिसे वह point करता है.

अंतर 4: Strings के साथ behaviour

char arr[] = "hello";   /* array में modifiable copy       */
char *p    = "hello";   /* read-only literal को point करता */

arr[0] = 'H';           /* OK                              */
p[0]   = 'H';           /* CRASH: undefined behaviour      */
यह सबसे practical अंतर और top interview trap है: string literals read-only memory में रहते हैं, इसलिए char* से literal पर लिखना crash करता है, जबकि char array अपनी writable copy रखता है.

पूरी comparison table

PointArrayPointer
sizeofसभी elements के total bytesAddress का size (4/8 bytes)
ReassignmentImpossibleकभी भी
arr++ / p++ErrorValid
Memoryसिर्फ elements का blockअलग 8-byte address holder
&nameपूरे array का address (int (*)[5])Pointer variable का address
String literal initWritable copyRead-only reference

Frequently Asked Questions

Is an array name a pointer in C?

No. An array name decays to a pointer to its first element in most expressions, but sizeof, & and non-assignability prove it is a distinct array type.

Why does sizeof(arr) differ from sizeof(p)?

sizeof(arr) returns the total bytes of all elements (e.g. 20 for int[5]), while sizeof(p) returns only the size of an address (8 bytes on 64-bit).

Why does char *p = "hello"; p[0]='H'; crash?

The string literal lives in read-only memory; writing through the pointer is undefined behaviour. A char array initialized from the literal holds a writable copy instead.