How to initialize a wchar_t variable?

前端 未结 3 1950
你的背包
你的背包 2020-12-31 12:59

I am reading the book: C: In a Nutshell, and after reading the section Character Sets, which talks about wide characters, I wrote this program:

<         


        
3条回答
  •  庸人自扰
    2020-12-31 13:36

    This works for me

    #include 
    #include 
    #include 
    #include 
    
    int main(void) {
      wchar_t wc = L'\x3b1';
    
      setlocale(LC_ALL, "en_US.UTF-8");
      wprintf(L"%lc\n", wc);
      return 0;
    }
    

提交回复
热议问题