Getting " invalid conversion" error while trying to test MQTT

I'm trying to publish for loop value via MQTT, but I'm getting "invalid conversion" error. I'm new to Arduino and C and don't know how to fix this.

  int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
   
  for (int n : arr) {
    client.publish("topic", n);  // invalid conversion from 'int' to 'const char*' [-fpermissive]
    delay(2000);
  }

Shouldn't n be a char as the error message suggests ?

client.publish("topic", char(n));

Still getting the same error.

Are you using PubSubClient ?

If so, then here are the signatures of the publish() functions in the library

   boolean publish(const char* topic, const char* payload);
   boolean publish(const char* topic, const char* payload, boolean retained);
   boolean publish(const char* topic, const uint8_t * payload, unsigned int plength);
   boolean publish(const char* topic, const uint8_t * payload, unsigned int plength, boolean retained);
   boolean publish_P(const char* topic, const char* payload, boolean retained);
   boolean publish_P(const char* topic, const uint8_t * payload, unsigned int plength, boolean retained);

It looks like the payload needs to be a pointer

client.publish( 'topic', String(n) );

that gives me "no matching function for call to 'PubSubClient::publish(const char [8], String)' " error.

const char* x="topic"
client.publish( x, String(n) );

Using overloaded #3:

client.publish("topic", &n, sizeof(n));