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 7752293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:45:45+00:00 2026-06-01T11:45:45+00:00

does any one know if, for example, I’m writing in c++ the following code:

  • 0

does any one know if, for example, I’m writing in c++ the following code:

int a;
void *ptr = &a;
ptr = (char *)ptr + 1; //<-- this is the interesting line;

Does the (char *) only tells the compiler how to address this variable?
Or does it actually add more calculations in run time?

Thanks.

  • 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-01T11:45:47+00:00Added an answer on June 1, 2026 at 11:45 am

    In this case, no extra calculations are done.

    However, there are some cases where a cast is technically a conversion, mostly with numeric input. For example the following could introduce runtime code (provided it is not optimised out, which in a small example like this you’d expect it to be):

    int x = 42;
    double d = (double)x;
    

    Here the internal representation of an int and a double means you cannot just change how the compiler sees the variable, you have to change the data as well.

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

Sidebar

Related Questions

Does any one know of an example on how to store an image in
does any one know if there is an example available for sliding panels in
Does anyone know a good online resource for example of R code? The programs
Does any one know there have any way I can share a information (it
Does any one know how can I write a SQL Server script to check
Does any one know how can I format the number and limited it to
Does any one know how I can specify the Default value for a DateTime
Hi does any one know how to check if a given DB object (Table/View/SP/Function)
Does any one know a great way to display the frequency of data for
Does any one know when is the best time to stop an NSTimer that

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.