Hello @Vinu George,
welcome to this moderated Azure community forum.
Because you are using code from a GitHub repo, I recommend submitting an issue in the repo with the question (please add a reference to that issue here).
Then, the owners of that azure-iot-arduino repo are aware about this question.
Because you use C, have you seen these samples?
See also this list of embedded device SDKs
As an alternative, check out the nanoFramework where you run C# code on a ESP32. You can even connect to the new EventGrid MQTT broker.
If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.