# passing structures in DC 9.62

**URL:** <https://forums.digi.com/t/passing-structures-in-dc-9-62/11096>\
**Category:** Rabbit\
**Created:** [April 6, 2009, 8:06pm UTC](https://forums.digi.com/t/passing-structures-in-dc-9-62/11096 "2009-04-06T20:06:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![User1152](https://avatars.discourse-cdn.com/v4/letter/u/c5a1d2/32.png) [@User1152](https://forums.digi.com/u/User1152)\
**Post date:** [April 6, 2009, 8:06pm UTC](https://forums.digi.com/t/passing-structures-in-dc-9-62/11096/1 "2009-04-06T20:06:02Z")

</div>

I’ve asked this on email support but I’m hoping to get a quicker answer here.

I read in the docs that structures are passed by VALUE in DC 9.62 and not by reference as in all other Cs I’ve used.

I have a function that “reads” a command string that is in the structure and sets various other elements of the structure based on the string. For example:

mbp.cmdID = (int)mbp.cmdstring ; (The first two bytes are an ID word)

This works great IN the function (according to the watch window) but it’s only working with a COPY of the structure since it was passed in by value on the stack and the changes are not made in the original structure.

If I try to pass &cmd\_packet, I get an invalid structure reference error when I compile. Is there anyway to pass a pointer to a structure so I can modify it’s elements in a function?

Any examples of doing this, how to define the functions parameters, etc. would be greatly appreciated.

len morgan
