You are here:

C/dereferencing operator

Advertisement


Question
hello sir, why * called a dereferencing operator???

Answer
Hi Dear rohit!

Deference or Indirection operator in C/C++ is usually referred to "*" ( Pointer ) , means it operates on a pointer  variable and returns the value at the memory location pointed by the pointer.

eg:

void main()
{
  int p = 10;
  int* ptr = &p;
  printf("The Value at the address pointed by the pointer ptr =%d",*ptr)
  *ptr = 20;
   printf("Now the new value is  =%d",*ptr)
}

Here in the above example:
The pointer variable ptr is initialized ( Set to point to ) with the address of p; *ptr deference's the variable p and set the value to 20 with this statement    *ptr=20; which is quit equal to the statement
p=20; this is what we used to call dereferencing .


Get back to me for more information about pointers

Thanks and Regards
Prince M. Premnath  

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Prince M. Premnath

Expertise


I'm sure that I can solve any doubts in Turbo C ,Graphics Programing ,Mouse, Hardware Programming ,File System ,Interrupts, BIOS handling , TSR Programming , General Concepts in C Language, handling inline Assembly statements

Experience

Research over 6+ Years

Organizations
CG-VAK Softwares and Exports Limited

Education/Credentials
Masters in Computer Applications

©2012 About.com, a part of The New York Times Company. All rights reserved.