About Pointer - DS TUTORIAL - onwnxcvnne
Headlines News :
Home » , , » About Pointer - DS TUTORIAL

About Pointer - DS TUTORIAL

Written By jomon on Monday 16 April 2012 | 04:27

A pointer is a variable which contain the memory address. It also points to a specific data types. Three operator are commonly  used  when dealing with pointer.
1    &    address operator
2    *  de-referencing operator
3    ->   structure pointer operator

Example:

In this example you will see how pointer works.

In the above figure you see that c is a variable of char data-type and it has value "A" inside. The address of variable c is 0X3000

Now in this figure you see that c is a variable of char data-type and it has value 'A' inside. The address variable c is 0X3000. And a pointer variable cptr of char data-type. The cptr pointer variable having the address of c variable rather value. So this is one the important difference between a general variable and pointer variable is that a pointer variable contains memory address.

A complete example

#include <stdio.h>
void main()
{
char c ='A';
char *cptr;
cptr=&c;
printf("\nThe address of c is\t%p",&c);
printf("\nValue of c is\t\t%c",c);
printf("\n\nThe address of cptr is\t %p",&cptr);
printf("\nValue of cptr is\t%p",cptr);
printf("\nAccess variable which cptr point to is\t%c",*cptr);
}

Output:


From the output of above example you can see that the address of these two variables are different and the pointer variable holding the address of another
 variable which it point to.

Previous - Introduction to Data Structures


 Data Structure Tutorial 

1.  Introduction to Data Structures
2.  Pointer in C 
3.  Pointer and Structure in C
4.  Linear and Non-Linear Data Structure in C
5.  Array Implementation in C
6.  Sum of array element in C
7.  Addition of two arrays element in C
8.  Inverse of an array in C
9.  Merge of two arrays in C 
10.Overview of Linked List
11.Singly Linked List
12.Doubly Linked List
13.Circular Linked List
14.Count number of nodes
15.Split a list into two equal size list
16.Merge two list into a single list
17.Stack
18.Push and Pop operation of stack.
19.Push and Pop operation of stack using linked list.
20.Queue implementation using array.
21.Queue implementation using linked list.
22.Circular queue implementation using array.
23.Tree data structure
24.Representing Graph using adjacency list & perform DFS & BFS



Share this article :

0 comments:

Speak up your mind

Tell us what you're thinking... !

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. onwnxcvnne - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger