1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// C23 Empty Initializer
struct Point {
int x;
int y;
};
void test_empty_init() {
// Empty initializer (C23)
struct Point p = {};
int arr[5] = {};
}
struct Nested {
int a;
struct Point p;
int arr[3];
};
void test_nested_empty() {
struct Nested n = {};
}
union Data {
int i;
float f;
};
void test_union_empty() {
union Data d = {};
}
// Arrays
void test_array_empty() {
int arr1[10] = {};
double arr2[5] = {};
char arr3[100] = {};
}
// With typedef
typedef struct {
int id;
char name[32];
} Record;
void test_typedef_empty() {
Record r = {};
}