(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 <string.h>
|
||||
|
||||
#define STRING_LEN ((size_t) 16)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
const void* pointer = (void*)(1000);
|
||||
printf("original pointer = %p\n", pointer);
|
||||
pointer = NULL;
|
||||
printf("changed pointer = %p\n", pointer);
|
||||
return 0;
|
||||
char string[STRING_LEN] = {'\0'};
|
||||
int n;
|
||||
|
||||
for (n = 0; n < (int)STRING_LEN; n++)
|
||||
{
|
||||
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