IPAddress

WiFi.localIP() returns an IP address of type IPAddress.

How can this IP address be converted to a char array?

It can be accessed either way.

IPAddress myIP = WiFi.localIP();

// as an IPAddress
Serial.println(myIP);

// as an array
for(int i = 0; i < 3; i++) {
Serial.print(myIP[i]);
Serial.print(".");
}
Serial.println(myIP[3]);

Works fine. Thanks.