GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Tech FAQs  >  OOPS

 Print  |  
Question:  What is the difference between constant to pointer and pointer to constant?



February 02, 2006 00:41:32 #1
 laxmikanth_rajuri   Member Since: Visitor    Total Comments: N/A 

RE: What is the difference between constant to pointer...
 

Constant pointer:If a pointer is pointing to a constant whose value(constant)can't be changed.

Eg:Consider the declaration int a[10];

here a is a pointer to the base address of the array say 1000.When we try to modify  a value say a++ or a-- it will give error because a is a constant pointer to the array.

pointer constant:If a pointer doesn't to points to any variable,array,structure,object,structure,etc...such pointer is known as pointer constant.

Eg:The well known example for pointer constant is the predefine Macro NULL.

NULL is a pointer constant which doesn't to points to any thing. 

     

 

Back To Question