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

  • Home
  • SEARCH
  • 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 6715841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:39:45+00:00 2026-05-26T08:39:45+00:00

This is an example of what my code looks like: void *a = NULL;

  • 0

This is an example of what my code looks like:

void *a = NULL;
void *b = //something;
a = (void *)(*((char *)b + 4));

The value that (b+4) is pointing to is an address that I want to store in a. When I try to compile, I get “warning: cast to pointer from integer of different size.” What does this mean, and what should I do to fix it?

EDIT: To clarify, I don’t want ‘a’ to point to an address that is 4 bytes greater than ‘b’. In my program, I know that the value stored at ((char *)b + 4) is itself another pointer, and I want to store this pointer in ‘a’.

  • 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-05-26T08:39:46+00:00Added an answer on May 26, 2026 at 8:39 am

    This is a char*:

    (char *)b + 4
    

    That means that this:

    *((char *)b + 4)
    

    is a char. Then you proceed to cast that char to a void* and the compiler complains. You don’t have to manually cast to void* in C so just this should do:

    a = (char *)b + 4;
    

    Update for comments: Sounds like you’re after this:

    a = *(char **)((char *)b + 4)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The questions says everything, take this example code: <ul id=css-id> <li> <something:CustomControl ID=SomeThingElse runat=server
This is what the current code looks like: public static class WidgetFactory { public
In JCIP we have a piece of code which looks like this: Listing 4.2:
A lot of times when reading source code I see something like this: public
I'm working with a XML structure that looks like this: <ROOT> <ELEM_A> <A_DATE>20100825</A_DATE> <A_TIME>141500</A_TIME>
take a look at this example code: public class Comment { private Comment() {
Take this example code (ignore it being horribly inefficient for the moment) let listToString
In this example code, I'm trying to offset the Grid 's Canvas position by
There is this example code, but then it starts talking about millisecond / nanosecond
With regards this example from Code Complete: Comparison Compare(int value1, int value2) { if

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.