Convert from string to float

Hi everyone is a bit of time we program with IDE 1.8 and C.
I thought I would do a program
I have a variable A = 3 and a variable B = 4 I would have a variable C = 3.4
This program in C works:

#include
#include <string.h>
#include <stdlib.h>
using namespace std;
main () {
char string [4];
string [0] = ‘3’;
string [1] = ‘.’;
string [2] = ‘4’;
float f;
f = strtof (string, NULL);
cout << f << endl;
}

I print “3,4”. If I want to load it in the arduino IDE by mistake “STRTOF”, how can I write the same program in the arduino IDE?

The older "atof" should be available.

void setup()
{
  Serial.begin(115200);
  char charArray[4];
  charArray[0] = '4';
  charArray[1] = '.';
  charArray[2] = '3';
  charArray[3] = '\0';
  Serial.println(atof(charArray), 1);
}

void loop()
{
}

This program in C

:o

Thank you