20 ms·
Firstly, isn’t that a syntax error? There’s a stray “const” in there. You probably meant const int * const hello = &world; Secondly, what should the compil
by teddyh 6y ago
Firstly, isn’t that a syntax error? There’s a stray “const” in there. You probably meant
const int * const hello = &world;
Secondly, what should the compiler complain about? You have a const int, and then a const pointer to const int, pointing to that first const int. What’s the problem?
Thirdly, the latest C version supported by GCC is “-std=c17”.
- tick_tock_tick 6y agoNah const is fun int main() { const int world = 42; const const const int const const * const const hello = &world; return 0; } Is a valid program https://onlinegdb.com/SJcwJrRzd https://onlinegdb.com/SJcwJrRzd
- teddyh 6y agoSure, but those extra “const” do not mean anything, and are apparently ignored by the compiler.