title: How can I make the structure involve in main?
body: <p>here is the program fragment:</p>
  <pre><code>struct part {
      int number;
      char name[NAME_LEN + 1];
      int on_hand;
  }inventory[MAX_PARTS];
  </code></pre>
  <p>and my problem here is I want to include the structure in the main but I don't know how to do it. Let me put the main in here but there are also other functions that I couldn't show.</p>
  <pre><code>int main(void)
  {
      char code;
  
      for (;;) {
          printf(&quot;Enter operation code: &quot;);
          scanf(&quot; %c&quot;, &amp;code);
          while (getchar() != '\n')   /* skips to end of line */
              ;
          switch (code) {
          case 'i': insert();
              break;
          case 's': search();
              break;
          case 'u': update();
              break;
          case 'p': print();
              break;
          case 'q': return 0;
          default:  printf(&quot;Illegal code\n&quot;);
          }
          printf(&quot;\n&quot;);
      }
  }
  </code></pre>