Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews C Plus Plus Language Interviews:C++ Access ControlC++ COM ActiveXC++ ConstructorsC++ ContainersC++ Exception HandlingC++ FriendC++ InheritanceC++ Inline FunctionC++ New And DeleteC++ Operator OverloadingC++ Pointers & FunctionsC++ ProgrammerC++ ReferencesC++ Static DataC++ SyntaxC++ TemplateC++ Type CheckingC++ Virtual Functions
Copyright © 2018. All Rights Reserved
C++ Pointers & Functions Interview Question:
What is Pointer to constant?
Submitted by: AdministratorPointer to constant points to a value that does not change and is declared as:
const type * name
type is data type
name is name of the pointer
e.g: const char *p;
pointer to constant can not be used to change the value being pointed to. Therefore:
char ch = ‘A';
const char *p = &ch;
*p = ‘B';
is not allowed. The program will throw an error.
Submitted by: Administrator
const type * name
type is data type
name is name of the pointer
e.g: const char *p;
pointer to constant can not be used to change the value being pointed to. Therefore:
char ch = ‘A';
const char *p = &ch;
*p = ‘B';
is not allowed. The program will throw an error.
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.