All Questions
Tagged with c23 compound-literals
2
questions
1
vote
2
answers
89
views
How to set a pointer to an integer in a compound literal that is initialized in a function?
I tried to initialise a structure via a compound literal in a function. After solving a part of my problem (see Use of compound literal inside a function to init a variable in C), I have a new problem ...
3
votes
2
answers
243
views
Initialize block-scope static const variable with pointer to compound literal?
The following code is rejected by GCC and Clang (godbolt link):
struct thing;
typedef enum {
THING_TYPE_A,
THING_TYPE_B,
} thing_type_t;
typedef struct thing_a {
int i;
} thing_a_t;
typedef ...