Skip to main content

Pointer Representation and Pointer Example Programs

2 min read Updated June 30, 2026
Share:
On this page (12sections)

Pointer Definition

  • The pointer is a programming language data type whose value refers directly to (or “points to”) another value stored elsewhere in the computer memory using its address.

Accessing The Address:

  • & - Locate the Variable Address
  • &variable
  • ponter_variable = &variable;

Pointer Representation

// Example program for Pointer Representation 
#include<stdio.h>
#include<conio.h>
void main()
{
	int i=10;
	printf("\nValue Of i :%d",i);
	printf("\nAddress Of i :%d",&i);
}

Declaring Pointer Variables

  • * and variable name
  • pointer variable points to a variable of type data_type

Pointer Syntax:

data_type *pt_name;

Pointer Syntax Example:

int *p;
float *x;

Initialization Of Pointer Variable:

pointer_vaibale = &variable;

Pointer Example program: 1

// Pointer Representation Example Program : 1
#include<stdio.h>
#include<conio.h>
void main()
{
	// Declaring Variables
	int i=10;
	int *Ptr;
	
	// Assigning Pointer
	Ptr=&i;

	/ Printing Values of Pointer
	printf("\nValue Of i :%d",i);
	printf("\nAddress Of i :%d",&i);
	printf("\nValue Of Ptr :%d",Ptr);
	printf("\nAddress Of Ptr :%d",&Ptr);
	printf("\nPtr's Pointer Value:%d",*Ptr);
	printf("\nPtr Equal to &i :%d",*(&i));
}

Pointer Example Program: 2

// Pointer Representation Example Program : 2
#include<stdio.h>
#include<conio.h>
void main()
{
	// Declaring Variables and Pointer
	int i=10;
	int *Ptr;
	Ptr=&i;

	// Printing Values of Pointer
	printf("\nValue Of i :%d",i);
	printf("\nAddress Of i :%d",&i);
	printf("\nValue Of Ptr :%d",Ptr);
	printf("\nAddress Of Ptr :%d",&Ptr);
	printf("\nPtr's Pointer Value:%d",*Ptr);
	printf("\nPtr Equal to &i :%d",*(&i));

	// Change Values of Using Pointer
	printf("\n\nWe Can Change Value Of i,Without Using i");
	*Ptr=100;
	printf("\nValue Of i :%d",i);
	printf("\nAddress Of i :%d",&i);
	printf("\nPtr's Pointer Value:%d",*Ptr);
	getch();
}

How It Works

This C program demonstrates Pointer Representation and Pointer. It first prepares the data it needs, then performs the core operation step by step, and finally prints the output shown in the Sample Output above.

  1. Declare the variables that hold the program’s data.
  2. Print the final result to the console so you can compare it with the sample output.

Try changing the input values and re-running the program to see how the output changes — this is the fastest way to understand how the logic behaves.

Frequently Asked Questions

What does this C program do?
It is a C example program that demonstrates Pointer Representation and Pointer, including the complete source code and the expected sample output.
How do I compile and run this C program?
Save the code in a `.c` file, compile it with `gcc filename.c -o program`, then run it with `./program` (or `program.exe` on Windows).
What concepts does this example use?
This example uses user-defined functions, illustrating a common pattern in C programming.

Related Tutorials

Search tutorials