JaxCze JaxCze - 2 months ago 4x
C Question

How to use value from dynamic array

I have dynamicly allocated array (via malloc) of numbers (called "double** metrix") and I need to get the right values and send them to the other function.

I can print the value rightly by using

printf("%d", metrix[1][1])
but when I try something like
double number; number = metrix[1][1]
I get random number (probably randomly selected part of memory?).

How to use this right to get the value I need? Thank you for any help and sorry for my english.


%d stands for decimal integer, not double. What you want is %f which means (fixed) floating point