Search This Blog
Welcome to 1printf(), your ultimate destination for C, C++, Linux, Data Structures, and Microcontroller programming! ๐ ๐นLearn advanced coding techniques in C& C++ ๐นMaster Linux internals & shell scripting ๐นDeep dive into Data Structures & Algorithms ๐นExplore Embedded Systems & Microcontrollers (8051,UART, RTOS) ๐นGet hands-on coding tutorials, project ideas,and interview preparation tips Whether you're a beginner or an experienced programmer, this channel will help you
Featured
- Get link
- X
- Other Apps
C Program for Referencing and Dereferencing (Pointers)
✅ C Program for Referencing and Dereferencing (Pointers)
#include<stdio.h>
int main()
{
int x = 10;
int *ptr = &x; // Referencing = storing the address of variable 'x' into pointer 'ptr'.
printf("%d", *ptr); // Dereferencing = fetching the value stored at that address (here 10).
}
๐ Explanation:
Pointers in C are used to store the address of variables.
- Referencing (&): The & operator is used to get the address of a variable.
- Dereferencing (*): The * operator is used to fetch the value stored at that address.
In this program:
int *ptr = &x;→ stores the address of x into pointer ptr.*ptr→ retrieves the value stored at that address (10).
๐งพ Sample Output:
10
๐ Keywords:
C pointers, referencing in C, dereferencing in C, pointer basics, beginner C programs, C interview questions on pointers
๐ Hashtags:
#CProgramming #Pointers #Referencing #Dereferencing #InterviewPrep
๐ Search Description:
Simple C program to demonstrate referencing (&) and dereferencing (*) using pointers. Explains storing an address and accessing value with sample output.
Popular Posts
C++ Program for Hybrid Inheritance (All Types Together)
- Get link
- X
- Other Apps
C++ Program for Function Overloading Example
- Get link
- X
- Other Apps
Comments
Post a Comment