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
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 213 of 255    Print  
What is the difference between constant to pointer and pointer to constant?

  
Total Answers and Comments: 2 Last Update: February 27, 2006     Asked by: sachinp1979 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
February 25, 2006 00:41:32   #1  
laxmikanth_rajuri        

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. 


 
Is this answer useful? Yes | No
February 27, 2006 05:20:54   #2  
venkatesh Member Since: November 2005   Contribution: 19    

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

pointer to constant: If a pointer is pointing to constant it is called as pointer to constant.In this case we cannot change the content of constant.

eg :  const int n=5;

  int *p=&n;

in this case we cannot change the value of n.

constant pointer:  If we declare a pointer as constant we can change the contents of memory pointed by pointer.But we cannot change the pointer value i.e incrementing or decrementing of pointer address.

Eg : const int *p=n;

Here we can change the content of n,but we cannot increment or decrement of pointer p(p++ or ++p).


 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : The basic difference in C and C++ structures is :1) In C , default access for structure members is public2) In C++ , defaulot access for structres is private ...

Latest Answer : overloading is mainly for operators and overriding is for functions ...

Latest Answer : Arrays have to difine with fixed size it will not grow dynamically , vector size can be increased bydynamically and vectors are synchronized.yaa always right.vector is a standard template library in C++. Vector size can be increased dynamically and stores ...

Explain "passing by value", "passing by pointer" and "passing by reference"
Tags : Pointer

Latest Answer : Calloc:- #include void *calloc(size_t nelem, size_t elsize);The calloc() function allocates space for an array of nelem elements of size elsize. The space is initialized to zero. Malloc:#include void *malloc(size_t size);The malloc() function allocates ...

Latest Answer :     printf is the standart function in (c) programming language library for printing  formatted output.egprintf writes the resulting string to the standard output(remember, Awk has only one output file).So, for example: printf("%sn","jellotHarold!")prints ...

Latest Answer : Both aggregation and composition are special kinds of associations. Aggregation is used to represent ownership or a whole/part relationship, and composition is used to represent an even stronger form of ownership. With composition, we get coincident lifetime ...

Latest Answer : Sequence diagrams describe interactions among classes in terms of an exchange of messages over time. Collaboration diagrams represent interactions between objects as a series of sequenced messages. Collaboration diagrams describe both the static structure ...

Latest Answer : uses and includes are the different avatars of the same concept. uses represents a concept in which one usecases uses the other. So when you invoke the former the latter is always invoked. Extends adds additional functionality, it is used when one ...

Latest Answer : There are some differences between Activity Diagram and Sequence Diagram -1)Using Sequence diagram it can be shown how processes execute in sequence; for example what operations are called in what order and what parameter. While using Activity diagram ...


 Sponsored Links

 
Related Articles

OOPS Tutorials

Object oriented programming OOP is a computer science term used to characterize a programming language that began development in the 1960’ s The term object oriented programming’ was originally coined by Xerox PARC to designate a computer application that describes the methodol
 

C++ Void Pointer and Null Pointer

C Void Pointer and Null Pointer In this C tutorial you will learn about two interesting types of pointers; void pointers and Null Pointer These pointers will be discussed in conjunction with syntax usage and example mosgoogle center Pointer to Void General Syntax void pointer variable; Void is use
 

What is difference between call by value and call by reference in function?

The arguments passed to function can be of two types 1. Values passed 2. Address passed The first type refers to call by value and the second type refers to call by reference. For instance consider program1 main() { int x=50, y=70; interchange(x,y); printf(“x=%d y=%d”,x,
 

Difference between Scholarship and Grant

Difference between Scholarship and Grant While both scholarships and grants allow students to pay for their tuition without having to pay the money back there are a number of key differences between the two Knowing the difference between grants and scholarship will make it much easier for students t
 

The Inheritance Concept In OOPs

The Inheritance Concept In OOPs In object oriented programming objects will be characterised by classes It is possible to learn a lot about an object based on the class it belongs to Even if you are not familiar with the name Maybach If I told you it is a car you would immediately know that it has f
 

Understanding The Message Concept In OOPs

Understanding The Message Concept In OOPs To understand object oriented programming you will need to become familiar with messages As the name implies a message is a process in which software objects will communicate with one another Because of this having one object is not enough mosgoogle An objec
 

The Difference Between Data Mart and Data Warehouse

The Difference Between Data Mart and Data Warehouse The biggest decision facing most IT managers today is whether or not they should construct the data mart before the data warehouse Many vendors will tell you that data warehouses are hard to build as well as expensive mosgoogle If you listen to som
 

Basic concepts of OOPS and Structure of C++ program

Basic concepts of OOPS and Structure of C program In this tutorial you will learn about Objects Classes Inheritance Data Abstraction Data Encapsulation Polymorphism Overloading Reusability Before starting to learn C it is essential that one must have a basic knowledge of the concepts of Object orie
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape