Jump to content
43oh

dynamic void* pointer issue in queue script.


Recommended Posts

Hi guys,

 

After a long day of trying, I think it's time to get some help.

Trying to make a dynamic queue with void* argument(s).

Maybe the memory allocation isn't suffcient?

Or the way the Item is retrieved from the Queu is not correct?

I can't see it anymore today :huh:

 

PS using CCStudio 6

 

 

main.c

Link to post
Share on other sites

Maybe the memory allocation isn't suffcient?

I took a look at your code @Lode, I think when you're copying QueueItems into your Queue, you should be copying the sizeof a QueueItem, not the sizeof QueueItem*

memcpy(&q->items[q->count], i, sizeof(struct QueueItem));

Before your code was just copying 1 words from the QueueItem into the Queue. Because that's the sizeof a QueueItem pointer.

 

This change worked for me on my G2335 Launchpad.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...