how to convert int in to const char in c

#include <stdio.h>
#include <stdlib.h>

int main() {
    int num = 123;
    char str[10];

    snprintf(str, sizeof(str), "%d", num);

    printf("Converted string: %s\n", str);

    return 0;
}