Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
13 views12 pages

Pointer (Data Structures) - Javatpoint

The document provides an overview of pointers in data structures, explaining their purpose in referencing memory addresses and the concept of dereferencing. It covers various aspects of pointers including pointer arithmetic, arrays of pointers, and passing pointers to functions in C, along with example code snippets. Additionally, it discusses the concept of pointers to pointers and their usage in programming.

Uploaded by

emilratiu00
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views12 pages

Pointer (Data Structures) - Javatpoint

The document provides an overview of pointers in data structures, explaining their purpose in referencing memory addresses and the concept of dereferencing. It covers various aspects of pointers including pointer arithmetic, arrays of pointers, and passing pointers to functions in C, along with example code snippets. Additionally, it discusses the concept of pointers to pointers and their usage in programming.

Uploaded by

emilratiu00
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

1/20/25, 8:53 PM Pointer (Data Structures) - javatpoint


Home Python Java JavaScript HTML SQL PHP C#

DS Tutorial

DS Tutorial

DS Introduction

DS Algorithm

Asymptotic Analysis

DS Pointer

DS Structure

DS Array

DS Array

2D Array

DS Linked List

Linked List

Types of Linked List

Singly Linked List

Doubly Linked List

Circular Linked List

Circular Doubly List

https://www.javatpoint.com/data-structure-pointer 1/12
1/20/25, 8:53 PM Pointer (Data Structures) - javatpoint

Skip list in DS

DS Stack

DS Stack

Array Implementation

← prev next →

Pointer
Pointer is used to points the address of the value stored anywhere in the computer
memory. To obtain the value stored at the location is known as dereferencing the pointer.
Pointer improves the performance for repetitive process such as:

Traversing String

Lookup Tables

Control Tables

Tree Structures

Pointer Details

https://www.javatpoint.com/data-structure-pointer 2/12
1/20/25, 8:53 PM Pointer (Data Structures) - javatpoint

Pointer arithmetic: There are four arithmetic operators that can be used in
pointers: ++, --, +, -

Array of pointers: You can define arrays to hold a number of pointers.

Pointer to pointer: C allows you to have pointer on a pointer and so on.

Passing pointers to functions in C: Passing an argument by reference or by


address enable the passed argument to be changed in the calling function by
the called function.

Return pointer from functions in C: C allows a function to return a pointer to


the local variable, static variable and dynamically allocated memory as well.

Program

Pointer

#include <stdio.h>

int main( )
{
int a = 5;
int *b;
b = &a;

https://www.javatpoint.com/data-structure-pointer 3/12
1/20/25, 8:53 PM Pointer (Data Structures) - javatpoint

printf ("value of a = %d\n", a);


printf ("value of a = %d\n", *(&a));
printf ("value of a = %d\n", *b);
printf ("address of a = %u\n", &a);
printf ("address of a = %d\n", b);
printf ("address of b = %u\n", &b);
printf ("value of b = address of a = %u", b);
return 0;
}

Output

value of a = 5
value of a = 5
address of a = 3010494292
address of a = -1284473004
address of b = 3010494296
value of b = address of a = 3010494292

Program

Pointer to Pointer

#include <stdio.h>

int main( )
{
int a = 5;
int *b;
int **c;
b = &a;
c = &b;
printf ("value of a = %d\n", a);
printf ("value of a = %d\n", *(&a));
printf ("value of a = %d\n", *b);

https://www.javatpoint.com/data-structure-pointer 4/12
1/20/25, 8:53 PM Pointer (Data Structures) - javatpoint

printf ("value of a = %d\n", **c);


printf ("value of b = address of a = %u\n", b);
printf ("value of c = address of b = %u\n", c);
printf ("address of a = %u\n", &a);
printf ("address of a = %u\n", b);
printf ("address of a = %u\n", *c);
printf ("address of b = %u\n", &b);
printf ("address of b = %u\n", c);
printf ("address of c = %u\n", &c);
return 0;
}

Pointer to Pointer

value of a = 5
value of a = 5
value of a = 5
value of a = 5
value of b = address of a = 2831685116

value of c = address of b = 2831685120


address of a = 2831685116
address of a = 2831685116
address of a = 2831685116
address of b = 2831685120
address of b = 2831685120
address of c = 2831685128

Next Topic DS Structure

← prev next →

https://www.javatpoint.com/data-structure-pointer 5/12
1/20/25, 8:53 PM Pointer (Data Structures) - javatpoint

Related Posts

DS Algorithm
What is an Algorithm? An algorithm is a process or a set of rules required to perform
calculations or some other problem-solving operations especially by a computer. The
formal definition of an algorithm is that it contains the finite set of instructions which are
being carried in...

 9 min read

DS Tutorial
Data Structures Tutorial Data Structures (DS) tutorial provides basic and advanced
concepts of Data Structure. Our Data Structure tutorial is designed for beginners and
professionals. Data Structure is a way to store and organize data so that it can be used
efficiently. Our Data Structure tutorial includes all topics of...

 7 min read

DS Structure
Structure A structure is a composite data type that defines a grouped list of variables that
are to be placed under one name in a block of memory. It allows different variables to be
accessed by using a single pointer to the structure. Syntax struct structure_name { ...

 1 min read

DS Introduction
An Introduction to Data Structures Since the invention of computers, people have been
using the term "Data" to refer to Computer Information, either transmitted or stored.
However, there is data that exists in order types as well. Data can be numbers or texts
written on a piece...

 20 min read

https://www.javatpoint.com/data-structure-pointer 6/12
1/20/25, 8:53 PM Pointer (Data Structures) - javatpoint

Asymptotic Analysis
As we know that data structure is a way of organizing the data efficiently and that
efficiency is measured either in terms of time or space. So, the ideal data structure is a
structure that occupies the least possible time to perform all its operation and...

 9 min read

Learn Important Tutorial

Python Java

Javascript HTML

Database PHP

https://www.javatpoint.com/data-structure-pointer 7/12
1/20/25, 8:53 PM Pointer (Data Structures) - javatpoint

C++ React

B.Tech / MCA

Data
DBMS
Structures

Operating
DAA
System

Computer Compiler
Network Design

Computer Discrete
Organization Mathematics

https://www.javatpoint.com/data-structure-pointer 8/12
1/20/25, 8:53 PM Pointer (Data Structures) - javatpoint

Ethical Computer
Hacking Graphics

Web Software
Technology Engineering

Cyber
Automata
Security

C
C++
Programming

Java .Net

Python Programs

https://www.javatpoint.com/data-structure-pointer 9/12
1/20/25, 8:53 PM Pointer (Data Structures) - javatpoint

Control Data
System Warehouse

Preparation

Aptitude Reasoning

Verbal Interview
Ability Questions

Company
Questions

https://www.javatpoint.com/data-structure-pointer 10/12
1/20/25, 8:53 PM Pointer (Data Structures) - javatpoint

https://www.javatpoint.com/data-structure-pointer 11/12
1/20/25, 8:53 PM Pointer (Data Structures) - javatpoint

https://www.javatpoint.com/data-structure-pointer 12/12

You might also like