📘 Lesson  ·  Lesson 54

Pointers in C

Pointers in C

What is a Pointer?

💡 Note

A pointer is a variable that stores the memory address of another variable.

Example

C
#include <stdio.h>
int main() {
    int x = 10;
    int *p = &x;       // p stores address of x
    printf("Value: %d\n", *p);   // dereference: 10
    printf("Address: %p\n", p);
    return 0;
}
Output:
Value: 10 Address: 0x7ffe...

Key Operators

  • &x gives the address of x.
  • *p gives the value stored at that address (dereference).

Summary

  • A pointer holds an address; & gets an address, * reads the value there.

Pointer क्या है?

💡 Note

Pointer एक variable है जो दूसरे variable का memory address रखता है।

Example

C
#include <stdio.h>
int main() {
    int x = 10;
    int *p = &x;       // p, x का address रखता है
    printf("Value: %d\n", *p);   // dereference: 10
    printf("Address: %p\n", p);
    return 0;
}
Output:
Value: 10 Address: 0x7ffe...

मुख्य Operators

  • &x x का address देता है।
  • *p उस address पर रखी value देता है (dereference)।

सारांश

  • Pointer address रखता है; & address देता, * वहाँ की value पढ़ता है।
← Back to C Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

\n