title: security of a const static struct object in C
body: <p>I am new to C programming and I am working on some project where I have to share lots of information between different source files .</p>
  
  <p>In one source file I declare and initialize a variable of a specific struct , and In other file I need to use a pointer to that variable , to access the information inside it , but not to change it.</p>
  
  <ol>
  <li>this variable CANNOT be changed anywhere else in my code .</li>
  <li>this variable CANNOT be global , it has to be static .</li>
  </ol>
  
  <p>code :</p>
  
  <pre><code>//file 1 :
  
  typedef struct {
      bool (*decodeParameters)(void* interface, uint8_t command, uint16_t parameters[]);
      bool value;
  } i_actuator_t;
  
  static const i_actuator_t iActuator = {
      decodeActuatorParameters,  //pointer to a function in the same file 1
      false
  };        //this variable has to be protected so it cannot be edited anywhere else , and it cannot be global .
  
  i_actuator_t* getActuatorInterface (void) = {
      return &amp;iActuator;
  }
  </code></pre>
  
  <p>and in <code>file 2</code>, I want to do something like this :</p>
  
  <pre><code>i_actuator_t* iActuatorPTR = getActuatorInterface();
  </code></pre>
  
  <p>is a <code>static const</code> variable the right thing to do here ?
  is there a better solution ?</p>
  
  <p>thanks</p>