how should I understand the array of two strings?
static struct S1 {
char c[3], *s;
} s1 = {"abc", "def" };
Probably the question is not correct but I have difficulties to understand how it works
S1.c
has space for 3 bytes and S1.s
is a pointer to a string.
the first part defines the structure:
struct S1 {
char c[3], *s;
};
The next part creates an instance of this type and initializes it with a few values:
static struct S1 s1 = {"abc", "def" };
static is not part of the struct definition. It refers to the visibility of the instance variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With