Skip to content

Instantly share code, notes, and snippets.

@elsl3
Created April 22, 2025 19:12
Show Gist options
  • Save elsl3/9dfcac9082c0193c335b65a26905ce8e to your computer and use it in GitHub Desktop.
Save elsl3/9dfcac9082c0193c335b65a26905ce8e to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <uchar.h>
int main(void) {
char16_t c16 = u'あ'; // UTF-16文字リテラル
char32_t c32 = U'𠮷'; // UTF-32文字リテラル(サロゲートペアを含む文字)
printf("char16_tのサイズ: %zu バイト\n", sizeof(c16));
printf("char32_tのサイズ: %zu バイト\n", sizeof(c32));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment