SE250:HTTB:Pointers:Uses of pointers
<html>
|
<image src="http://www.rajithaonline.com/SE250/httb/pointers/final/uses_head.png" width="353" height="92" alt="Uses Header Logo" /> |
</html>
| Previous Page | Contents | Next Page |
Pointer use in other topics
Linked Lists
A linked list structure is made of data cells ordered and linked by pointers. Example: Definition for data cell
typedef struct {
int data;
struct node *next;
} cell;
Every instance of a data cell contains a pointer which can point to the next data cell in the list.
For more details read Linked Lists
Array-based Lists
An array-based list structure consists of a defined "node" pointing to the start of an array. Example:
typedef struct {
int *start;
int capacity;
int length;
} Arraylist
The data in the array can be modified by applying Pointer Arithmetic on the *start pointer.
For more details read Array-based Lists
Binary Search Trees
A binary search tree consists of "nodes", with each node having pointers to neighbouring nodes. Example:
typedef
struct Node {
int data;
struct Node *left;
struct Node *right;
struct Node *parent;
} Node;
Each node will store data as well as point to other adjacent nodes. This is similar to the data cells of a linked list.
For more details read Binary_Search_Trees
| Previous Page | Contents | Next Page |