C: Integer expression is required in switch instead of XY
<p>I have a small problem with switch and structure.</p>

<p>I have an enum of all instructions. This recond in storaged in Instr struct (with the 3 pointers on node adress- as a three adress code)</p>

<pre><code>typedef enum {
    // BUILT-IN FUNCTIONS
    insIfj16readInt,
    insIfj16readDouble,
    insIfj16readString,
    insIfj16lenght,
    insIfj16substr,
    insIfj16compare,
    insIfj16find,
    insIfj16sort,
    insIfj16print,
    //
    // MATH
    insPlus, 
    insMinus, 
    insMux, 
    insDiv, 
    //
    //COMPARE
    insEqual, 
    insNotEqual, 
    insLess, 
    insLessOrEqual, 
    insGreater, 
    insGreaterOrEqual, 
    insAssignment,
    insFunctionCall
}InstrType;

typedef struct Instr {
    BTSNode *Id1; 
    BTSNode *Id2; 
    BTSNode *Id3;
    InstrType *type;
}Instr;
</code></pre>

<p>But now, the compiler started complaining about switch values.</p>

<p>Switch code is like this:</p>

<pre><code>instrStack *instrStack;
    // Pointer on instruction
    struct Instr *instruction;
    // Taking the first instruction from the instruction stack
    instruction = instrStackTop(instrStack);

    while(instruction != NULL) {
        instruction = instrStackTop(instrStack);

        switch (instruction-&gt;type) {
            // BUILT-IN FUNCTIONS

            case  insIfj16readInt:
                if(instruction-&gt;Id3-&gt;inc == 1) {
                    if (instruction-&gt;Id3-&gt;data.type == var_int) {
                        instruction-&gt;Id3-&gt;data.value.intValue = readInt();

                    } else {
                        throwException(4,0,0);
                    }

                } else {
                    throwException(8, 0, 0);
                }
                break;
            case insIfj16readString:

         etc. etc. more code and so one.
</code></pre>

<p>So here is the compiler complain: </p>

<blockquote>
  <p><strong>"Integer expression is required in switch instead of 'InstrType *'</strong></p>
</blockquote>

<p>I really don't know why is this happening. I'm using same "system" with switch and enum on my lexical analyzer (I just changing states of automat) and there is no problem with this.</p>