Pointers and their Rules in C

Blog Author


Published Date

1st April, 2021




  • Share this blog :


Pointers and their Rules in C Language

Arithmetic operation on pointers

  int i1,i2; in t*p1,*p2; p1=&p1; p2=&p2;  

  • p1+p2; error
  • p1+1, Next address
  • ++p1,p1++ = Next Address
  • p2-p1 No of elements
  • p2-1; previous elements address
  • - -p2, Previous Address
  • p1*p2; error
  • p1*5; error
  • p1/p2; error
  • p1/p2; error
  • p1%p2; error
  • p1%2.error p2-

Pointer rules :

Rule 1:

Address + Number = Address (Next Address) Address – Number  = Address(pre Address) Address ++=Address(Next address) Address--=Address(Pre Address) ++ Address= Address(Next Address) --Address = Address(Pre address)  

Rule 2:

Address – Address = Number(No.of elements) = size diff/sizeof(datatype) int*p1=(int*)100; int*p2=(int*)200; p2-p1=50 200-100 ------- > 100/size of(int)  

Rule 3:

Address + Address=Illegal. Address * Address= illegal Address/Address= illegal Address%Address=illegal  

Rule 4:

We can use relational operator and conditional operator b/w two pointers(<,>,<=,>=,==,!=,?!) Address  > Address = T/F Address  > = Address = T/F  

Rule 5:      

We can’t perform bitwise operation b/w two pointers like Address & Address = illegal Address | Address=Illegal Address ^ Address = illegal ~ Address=illegal  

Rule 6:

We can find the size of a pointer using the size of the operator.              

For an in-depth understanding of Pointers click on

About Author


Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .

Related Blogs

Write For Us