title: C error expected identifier
body: <p>I was trying to test my code so far, and when compiling a test run I'm getting an error.</p>
  
  <p>Here is my code:</p>
  
  <p>mips_op.h file</p>
  
  <pre><code>#ifndef MIPS_OP_H
  #define MIPS_OP_H
  
  typedef enum {
      R, I, J
  } op_type;
  
  typedef struct op_instr {
      op_type op_t; // instruction type {R, I, J}
      int opcode : 6; // instruction opcode - 6-bit integer
  
      // if the instruction type is J
      #if op_t == J
  
      int address : 26; // address to jump to - 26-bit integer
  
      #else // if the instruction type is R or I
  
      int rs : 5; // the output - 5-bit integer
      int rt : 5; // the first operand - 5-bit integer
  
          #if op_t == R // if instruction type is R
  
          int rd : 5; // the second operand - 5-bit integer
          int shamt : 5; // the shift amount field - 5-bit integer
          int funct : 6; // the function field
  
          #endif
  
          #if op_t == I // if instruction type is R
  
          int immediate : 16; // the immediate field - 16-bit integer
  
          #endif
  
      #endif
  };
  
  #endif
  </code></pre>
  
  <p>and here is main.c file</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include "mips_op.h"
  
  int main (void) {
      printf("Before instr\n");
  
      op_instr add;
  
      printf("After instr\n");
  
      return 0;
  }
  </code></pre>
  
  <p>and here is the error I'm getting</p>
  
  <pre><code>In file included from main.c:2:0:
  mips_op.h:9:10: error: expected ')' before 'op_t'
  main.c: In function 'main':
  main.c:7:2: error: unknown type name 'op_instr'
  </code></pre>
  
  <p>What is wrong with my code? Why am I getting this error?</p>
  
  <p>Thanks</p>
  
  <p>EDIT: Fixed the brackets to curly brackets</p>