(clang) tested array initialisation in

This commit is contained in:
scbj
2026-02-03 10:01:53 +01:00
parent ac3fa61211
commit 0f7acf58e7
+21 -5
View File
@@ -1,10 +1,26 @@
#include <stddef.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#define STRING_LEN ((size_t) 16)
int main(void) int main(void)
{ {
const void* pointer = (void*)(1000); char string[STRING_LEN] = {'\0'};
printf("original pointer = %p\n", pointer); int n;
pointer = NULL;
printf("changed pointer = %p\n", pointer); for (n = 0; n < (int)STRING_LEN; n++)
return 0; {
printf("%2d: [0x%02X]\n", n, string[n]);
}
(void) strcpy(&string[0], "hello there");
printf("\n");
for (n = 0; n < (int)STRING_LEN; n++)
{
printf("%02d: [0x%02X]\n", n, string[n]);
}
} }