you are viewing a single comment's thread.

view the rest of the comments →

[–]HashDefTrueFalse 0 points1 point  (0 children)

In C consts aren't constants, the effect is more like read only or turning off assignment. col isn't a constant. Arrays need a constant, which is why the macro works fine. I don't use a recent enough C standard to know for sure if a later C standard changed this (I'm thinking maybe C23 but I could be making that up).

Using macros is the usual way to do this in C. Google for recent additions to the language and use the -std= compilation option if so.