Send coordinate code with RF 433Mhz

#include <SoftwareSerial.h>
#include <VirtualWire.h>
#define DEBUG true
#define rfTransmitPin 4
SoftwareSerial mySerial(2, 3);
#include <math.h>
#include <stdlib.h>

String lat, lng;
char LAT[20]; 


void getgps(void) {
  sendData( "AT+CGNSINF", 1000, DEBUG);
  sendData( "AT+CGNSPWR=1", 1000, DEBUG);
  sendData( "AT+CGPSINF=0", 1000, DEBUG);

}


void sendData(String command, const int timeout, boolean debug) {
  String response = "";
  mySerial.println(command);
  delay(5);
  if (debug) {
    long int time = millis();
    while ( (time + timeout) > millis()) {
      while (mySerial.available()) {
        response += char(mySerial.read());
      }
    }
    lat = "";
    if (response[19] != NULL)
    {
      for (int i = 46; i <= 54; i++)
      {
        lat = lat + response [i];
      }
      Serial.print("Lat: ");
      Serial.println(lat);
    }
    lng = "";
    if (response[19] != NULL)
    {
      for (int i = 56; i <= 65; i++)
      {
        lng = lng + response [i];
      }
      Serial.print("Long: ");
      Serial.println(lng);
    }
    delay (300);
  }
}

void setup() {
  getgps();
  //pinMode (pushButton, INPUT);
  Serial.begin(9600);
  mySerial.begin(9600);
  //Serial.println ("Tugas Akhir Ria Juliani Dewi");

  pinMode (5, INPUT);
  pinMode(rfTransmitPin, OUTPUT);
  //vw_set_tx_pin(4);
  //vw_setup(2000);
}

void loop() {
 char msg[24];
 sprintf(msg, "%s", lat);
  vw_send((uint8_t *)msg, strlen(msg));
  
}

thats my code for my project, i'm using module GSM800L for get the coordinate, and now i must send the coordinate using RF 433Mhz,
but i dont know why thats code error when i try to sending

" invalid cast from type 'String' to type 'uint8_t* {aka unsigned char*}' "

i get that error

but i dont know why thats code error when i try to sending

Neither do we, so post the details of the error message and tell us what else goes wrong.

jremington:
Neither do we, so post the details of the error message and tell us what else goes wrong.

" invalid cast from type 'String' to type 'uint8_t* {aka unsigned char*}' "

i get that error

sprintf() does not work with String objects, and you should not either. They cause memory problems with Arduino.