Unable to send variable as SMS using SIM900 Module

Hello All,

I am trying to send a variable as sms using SIM900 gsm module.
I am able to sendsms when i directly send a string.
If i try to change a integer to string and try to send it by same function, then sms is not sent.

#include "SIM900.h"
#include <SoftwareSerial.h>
#include <Wire.h>

#include <ds3231.h>
#include "RTClib.h"
RTC_DS1307 rtc;

#include "sms.h"
SMSGSM sms;

//the setup routine runs once when you press reset

void setup() {

  Serial.begin(9600); //initialize serial comm. at 9600 bits per second
  
  Wire.begin();
 
}

//the loop routine runs over and over again forever
void loop() {

DateTime now = rtc.now();

int x = now.hour();
char p[5];
sprintf(p, "%d" , x);
Serial.println(p);

    if (sms.SendSMS("7676555477", p))
    {
         Serial.println("sms sent"); 
     
    }
  
}

Can any one please check the code and let me know, what could be the issue?
Please ask for any clarifications.

are you saying that if you replace sms.SendSMS("7676555477", p)bysms.SendSMS("7676555477", "17")then the SMS is sent [u]WITHOUT[/u] modifying anything else? (no change to the rest of the code, no change in wires etc)

can you describe what is connected where and the hardware you have?

Thank you for the reply.

we had made a small mistake in the hardware connection.
we were able to solve it.
Now we are receiving msgs with variables.

Thanks
Parma