title: What is causing "warning: pointer/integer type mismatch in conditional expression"?
body: <p>I have an enum, and a macro definition and a method that all use the enum. I can't get it to compile. Consider the following pieces of code.</p>
  
  <pre><code>typedef enum fruits_t
  {
      APPLE,
      ORANGE,
      BANANA
  } fruits_t;
  
  #define KEY_TO_VALUE(x) ((x == APPLE) ? 0 :  \
                           (x == ORANGE) ? 1 :  \
                           (x == BANANA) ? 2 : \
                           "Undefined")
  
  static void foo(char fruit) {
      if (fruit == KEY_TO_VALUE(APPLE)) {
          /* do something */
      }
  }
  </code></pre>
  
  <p>This compiles, but I get the following warnings.</p>
  
  <p><code>warning: pointer/integer type mismatch in conditional expression</code></p>
  
  <p><code>warning: comparison between pointer and integer</code></p>
  
  <p>Why? I am very new to C, so if you could explain things that may seem obvious to an experienced C developer, I'd appreciate it. Most of my programming knowledge is Java based.</p>