Code:
typedef struct
{
// stuff
unsigned char* pwm;
} Motor;
void InitMotor( Motor* motor, unsigned char* pwm, /* more parameters */ )
{
// stuff
motor->pwm = pwm;
}
then if I want to change the motor speed
Motor myMotor; InitMotor( &myMotor, &pwm10 );
*myMotor.pwm = 127; // set it to nuetral
need * to dereference the pointer and & to pass a pointer in the places shown