c - Issues printing matrix values -


i new using matrices in c. have been having issues in piece of maths uses them. debug, trying check matrix stored correctly , have put following code in debug.

float regression_matrix[5][4] = {3.2, -2.8, -0.8, 2.2, -0.8, -3.0, 4.3, 0.9, -3.4, 1.3, 0.9,-1.6,-0.1,2.2,-0.8}; //input cubic regression values regression_matrix[1][2] = 12; float k = regression_matrix[1][2]; pc.printf("matrix 1,2 %d %f\r\n", k);  // display adc readings 

the output -19.200001, has come from? not sure if miss-using printf command or have issues in setting matrix?

any ideas appreciated.

here:

printf("matrix 1,2 %d %f\r\n", k); 

you have 2 format specifiers 1 argument. leads undefined behavior. want

printf("matrix 1,2 %f\r\n", k); 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -