good day guys. i was studying a particular block of code and came across an operator: ->. im not exactly sure what it does. i found some notes saying that ptr-> is equivalent to(*ptr). for the life of me i just cant see how that applies here. care to help? thanks

void init_Gyro1DKalman(struct Gyro1DKalman *filterdata, float Q_angle, float Q_gyro, float R_angle)
{
	filterdata->Q_angle = Q_angle;         
	filterdata->Q_gyro  = Q_gyro;
	filterdata->R_angle = R_angle;
}

and here's the structure of gyro1dkalman

struct Gyro1DKalman
{
	float x_angle,
	      x_bias;

	float P_00,
	      P_01,
	      P_10,
	      P_11;	
	
	float Q_angle, Q_gyro;

	float R_angle;
};

Well it's not that hard to figure out ;)
It refers to a field of the struct..

filterdata->Q_angle = Q_angle;

thank you for replying sir. so what does this operation do?

It means

(*filterdata).Q_angle = Q_angle;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.