Hello guys!

I'm programming ICE in C, and because I haven't written any C before, I have some questions.
  • How can I define a structure to be located at location X, and then I push/pop to it? I've now this code:

    Code:
    typedef struct outputStack {
        uint8_t  type;
        uint24_t operand;
        size_t   size;
    };

    with

    Code:
    struct outputStack *outputPtr;
        outputPtr = (struct outputStack *) (uint24_t*)0xD62C00;
       
        outputPtr.size = 0;

    but that doesn't work Sad
  • More follows...

Thanks in advance! Smile
PT_ wrote:

Code:
struct outputStack *outputPtr;
    outputPtr = (struct outputStack *) (uint24_t*)0xD62C00;
   
    outputPtr.size = 0;

but that doesn't work Sad
If your goal is making a puzzle "it doesn't work" might be okay, but if you're asking for help it's spectacularly unhelpful. What happens? What do you expect to happen?

Fortunately I spotted what is probably your problem- accessing struct members through pointers must use the -> operator:

Code:
struct foo *foo = malloc(sizeof(struct foo));
foo->bar = 0;
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement