How to check if a variable is of "const" qualifier type in C?
<p>Sample code to check</p>

<pre><code>#include&lt;stdio.h&gt;

int main(void)
{
    const int i = 1;
    printf("Variable i is %s\n",
           __builtin_constant_p(i) ? "a const variable" : "not a const variable");
    return 0;
}
</code></pre>

<p>Output :</p>

<pre><code>Variable i is not a const variable
</code></pre>

<p>Is <code>__builtin_constant_p()</code> not the right API to determine whether a variable is of type <code>const</code> or not?</p>