(clang) tested array initialisation in
This commit is contained in:
+21
-5
@@ -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]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user