Печать символа Unicode (хранится в переменных) в C

Я должен напечатать некоторыеunicode (4-значный шестнадцатеричный) символов вC.

Те символы, которые я сохранил в некоторыхshort int переменные. Ниже приведен код, который я должен использовать для своих целей:

#include <stdio.h>
#include <locale.h>
#include <wchar.h>

int main(void) {

    setlocale(LC_ALL,"");

    short a = 0x099A, b = 0x09BE;
    wchar_t *string1 = (wchar_t *) calloc(20, sizeof(wchar_t));
    sprintf(string1, "\\u%04x\\u%04x", a, b);
    printf(" %s ", string1);

    wchar_t *string2 = (wchar_t *) calloc(20, sizeof(wchar_t));
    strcpy(string2, (wchar_t *) "\u099A\u09BE");
    printf(" %s \n", string2);

    return 0;
}

Теперь проблема заключается в следующем:

although string2 is showing the corect output in terminal, string1 isn't.

But I must use the 1st approach, i.e I have the unicode characters stored in some arbitrary variables & I need a way to get them printed on screen.

Любое предложение должно быть высоко оценено.

Ответы на вопрос(1)

Ваш ответ на вопрос