what the right code for using log10(x) with math.h

Hello,

how it's possible to use log10(x) to arduino code ?

i want to use the log10(x) where x is a float in arduino code.

my code is :

#include <math.h>

float tab [ ] = {2,3; 5,9; 0,96};
float log_tab [3]={0; 0; 0};

for (int i=0, i<3, i++)
{
log_tab [i] = log10(tab[i]);
}

Thanks

Here is how to write a float:

2.3

And how to put elements in an array:

{ a, b, c }

Edit: in theory a float should be written 2.3f to differenciate it from a double, but doubles and floats are the same thing for Arduino (except the Due maybe?)

#include <math.h>

float tab [] = {2.3, 5.9, 0.96};  // correct syntax for floats and array initializers
float log_tab [3] ;   // how to declare an uninitialised array

for (int i=0, i<3, i++)
{
  log_tab [i] = log10 (tab[i]);
}

Thanks a lot MarkT and guix for reply.

NP