Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8408495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:38:50+00:00 2026-06-09T23:38:50+00:00

In the below code: int a=5,b=6,c=7;; int *const ptr = &a; //if ptr =

  • 0

In the below code:

int a=5,b=6,c=7;;
int *const ptr = &a;

//if ptr = &b; is wrong since it is a pointer constant.

whether deferencing the pointer is applicable or not?

*ptr = 8; //is it allowed?

If not, then why?

Then in which places is the deferencing applicable?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:38:51+00:00Added an answer on June 9, 2026 at 11:38 pm
    int *const ptr = &a;
    

    In this case the pointer is constant but the data to which it points is not constant.
    So you cannot make the pointer point to some other variable but you can modify the pointed value.

    *ptr = 8; 
    

    is allowed because it only changes the value stored at the address to which the pointer points.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the below code snippet: int main() { const int i=3; int *ptr; ptr=const_cast<int*>(&i);
i have the following code below: const char* timeformat = %Y-%m-%d %H:%M:%S; const int
The below code generates the incompatible pointer type error: char *PLURAL(int objects, NSString *singluar,
The below code in Java throws Null pointer exception. public class New{ int i;
Possible Duplicate: Modifying a const through a non-const pointer lets' see the code below
Check the below code int add(int a, int b) { return a + b;
for the Given below code after int Input Value of 46348 i am getting
Int he below code a textarea is added 6 times and initially the textarea
I have something like the code below: for(int i=0;i<10;i++){ button=new JButton(buttons[i]); button.addActionListener(new ActionListener(){ public
Please see below code: thrust::device_vector<int>::iterator whereToBegin = copyListOfNgramCounteachdoc.begin(); end = thrust::unique_by_key(end.first, end.first + numUniqueNgrams,end.second);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.