Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,9 @@
#include <string.h>
int main(void)
{
const char *string = "Hello, world!";
size_t length = strlen(string);
return 0;
}

View file

@ -0,0 +1,10 @@
int main(void)
{
const char *string = "Hello, world!";
size_t length = 0;
const char *p = string;
while (*p++ != '\0') length++;
return 0;
}

View file

@ -0,0 +1,9 @@
#include <stdlib.h>
int main(void)
{
char s[] = "Hello, world!";
size_t length = sizeof s - 1;
return 0;
}

View file

@ -0,0 +1,14 @@
#include <stdio.h>
#include <wchar.h>
int main(void)
{
wchar_t *s = L"\x304A\x306F\x3088\x3046"; /* Japanese hiragana ohayou */
size_t length;
length = wcslen(s);
printf("Length in characters = %d\n", length);
printf("Length in bytes = %d\n", sizeof(s) * sizeof(wchar_t));
return 0;
}

View file

@ -0,0 +1,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main()
{
setlocale(LC_CTYPE, "");
char moose[] = "møøse";
printf("bytes: %d\n", sizeof(moose) - 1);
printf("chars: %d\n", (int)mbstowcs(0, moose, 0));
return 0;
}