title: Undeclared (first use in this function) in C Macro
body: <pre><code>#define CREDITS_COURSE1 4
  #define CREDITS_COURSE2 5
  #define CREDITS_COURSE3 4
  #define CREDITS_COURSE4 4
  #define CREDITS_COURSE5 3
  #define CREDITS_COURSE6 3
  #define CREDITS_COURSE7 2
  #define CREDITS_COURSE8 3
  
  #define COURSE(number) CREDITS_COURSE##number
  
  int main()
  {   for(int i=1;i&lt;9;i++)
      printf(&quot;%d\n&quot;,COURSE(i));
  }
  </code></pre>
  <p>I am expecting it to print respective value defined
  but instead it is showing the error</p>
  <pre><code> error: 'CREDITS_COURSEi' undeclared (first use in this function); did you mean 'CREDITS_COURSE1'?
     10 | #define COURSE(number) CREDITS_COURSE##number
        |                        ^~~~~~~~~~~~~~
  cc.c:14:19: note: in expansion of macro 'COURSE'
     14 |     printf(&quot;%d\n&quot;,COURSE(i));
        |                   ^~~~~~
  cc.c:10:24: note: each undeclared identifier is reported only once for each function it appears in
     10 | #define COURSE(number) CREDITS_COURSE##number
        |                        ^~~~~~~~~~~~~~
  cc.c:14:19: note: in expansion of macro 'COURSE'
     14 |     printf(&quot;%d\n&quot;,COURSE(i));
        |                   ^~~~~~
  </code></pre>
  <p>So can you please help me to get the answer</p>
  <p>For Example</p>
  <p>COURSE(1) should print me out 4</p>
  <p>COURSE(2) should print me out 5</p>