R2D2
R2D2

Reputation: 2640

formatting printf statement in cpp file

I have a cpp file within an xcode application, but am having trouble formatting the printf correctly.

My code is:

b2Vec2 axisA = b2MulT(xfA.R, m_axis);
printf("axis A = XXX", axisA);

I need to know what to put in XXX to print out the value of the 'axisA' variable.

Thanks

Upvotes: 0

Views: 137

Answers (1)

egur
egur

Reputation: 7960

Printf accepts only plain data types, so you need to break it down:

printf("axis A = (%f,%f)", axisA.x, axisA.y);

or

printf("axis A = (%g,%g", axisA.x, axisA.y);

Upvotes: 2

Related Questions