| ||||||||
Technical Support Support Resources Product Information | C166: MODIFYING A STRUCT USING POINTERSQUESTIONHelp. I'm using C166 and I'm having trouble modifying a local structure using pointers I pass to other functions. Can you give me an example of how to do this? ANSWERThe following program demonstrates creating a local structure and passing a pointer to it to other functions.
struct myst
{
int a;
int b;
int c;
int d;
};
void func_a (
struct myst *x)
{
x->a = 0xFF00;
}
void func_b (
struct myst *x)
{
x->b = 0x00FF;
}
void main (void)
{
struct myst xxx = { 1,2,3,4 };
func_a (&xxx);
func_b (&xxx);
while (1);
}
Last Reviewed: Sunday, May 16, 2004 | |||||||
| ||||||||