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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:19:28+00:00 2026-06-14T18:19:28+00:00

I’m doing a project using the Microchip C18 compiler. I have a struct called

  • 0

I’m doing a project using the Microchip C18 compiler. I have a struct called a block that points to other blocks (north east south west). These blocks will make me a map.
I then have a pointer that I use to evaluate everything.

Just using RAM it looks like:

struct block{
        struct block *north;
        struct block *east;
        struct block *south;
        struct block *west;
};


struct block map[5] =
{ // just a simple line.
        { NULL, &map[1], NULL, NULL },
        { NULL, &map[2], NULL, &map[0]},
        { NULL, &map[3], NULL, &map[2]},
        { NULL, &map[4], NULL, &map[3]},
        { NULL, NULL, NULL, &map[4]}
};


struct block* position = &map[0];

This lets me do stuff like:

void goWest()
{
if(position -> west != NULL) position = position -> west;
}

Problem is that I’ve run out of RAM in my project and need to use ROM
What I have so far is:

struct block{
        rom struct block *north;
        rom struct block *east;
        rom struct block *south;
        rom struct block *west;
};
rom struct block map[5] =
{ // just a simple line.
        { NULL, &map[1], NULL, NULL },
        { NULL, &map[2], NULL, &map[0]},
        { NULL, &map[3], NULL, &map[2]},
        { NULL, &map[4], NULL, &map[3]},
        { NULL, NULL, NULL, &map[4]}
};

I’ve done some debugging and can tell the above part works, but trying to make the position pointer is giving me grief.
so I guess my question is:

How do I hold the ROM variable addresses in a pointer which I can edit the values of?

When i try:

struct block *position = &map[0];

I get “Warning [2066] type qualifier mismatch in assignment”

I realize that a ROM variable and RAM variable are two different things,
but I have no idea what to do.

  • 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-14T18:19:29+00:00Added an answer on June 14, 2026 at 6:19 pm

    What is the definition of the rom macro? I’m guessing that it expands to const (and possibly a compiler-specific __attribute__ or somesuch), because the compiler is complaining about a “type qualifier mismatch”, which refers to a const or volatile mismatch.

    What that means is that you’re trying to implicitly cast a pointer to constant data into a pointer to non-constant data. This code should generate the same warning with your compiler:

    const int x = 0;
    int *y = &x;  // &x is "pointer to const" but y is "pointer to non-const"
    

    To fix it, you need to declare that your position pointer is a pointer to constant data (which, depending on the definition of the rom macro, should be done with either rom or the const qualifier):

    // Declare a non-constant pointer to constant data
    const struct block *position = &map[0];
    

    At each pointer level, you can have a const qualifier or lack thereof, and likewise for the base non-pointer object. So, a single-level pointer can have 4 different variants:

    int *x;  // Non-constant pointer to non-constant data
    int *const x;  // Constant pointer to non-constant data
    const int *x;  // Non-constant pointer to constant data
    int const *x;  // Same as above
    const int *const x;  // Constant pointer to constant data
    int const *const x;  // Same as above
    

    Note that int const and const int are equivalent, but otherwise the placement of const does matter.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a small JavaScript validation script that validates inputs based on Regex. I
I am doing a simple coin flipping experiment for class that involves flipping a
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.