title: Defining const values in C
body: <p>I have a C project where all code is organized in <code>*.c</code>/<code>*.h</code> file pairs, and I need to define a constant value in one file, which will be however also be used in other files. How should I declare and define this value?</p>
  
  <p>Should it be as <code>static const ...</code> in the <code>*.h</code> file? As <code>extern const ...</code> in the <code>*.h</code> file and defined in the <code>*.c</code> file? In what way does it matter if the value is not a primitive datatype (<code>int</code>, <code>double</code>, etc), but a <code>char *</code> or a <code>struct</code>? (Though in my case it is a <code>double</code>.)</p>
  
  <p>Defining stuff inside <code>*.h</code> files doesn't seem like a good idea generally; one should declare things in the <code>*.h</code> file, but define them in the <code>*.c</code> file. However, the <code>extern const ...</code> approach seems inefficient, as the compiler wouldn't be able to inline the value, it instead having to be accessed via its address all the time.</p>
  
  <p>I guess the essence of this question is: Should one define <code>static const ...</code> values in <code>*.h</code> files in C, in order to use them in more that one place?</p>