title: Dequeue function does not work
body: <p>I'm trying to learn about C using codeblock, part of my assignment is to use queue as an input and output method.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  typedef struct QUEUE {
      int head, tail;
      int list[4];
  } queue;
  
  void create( queue *q ) {
      q-&gt;head = 0;
      q-&gt;tail = 0;
  }
  
  int empty( queue *q ) {
      if ( q-&gt;tail == 0 )
          return 1;
      else
          return 0;
  }
  
  int full( queue *q ) {
      if ( q-&gt;tail == 4 )
          return 1;
      else
          return 0;
  }
  
  void enqueue( queue *q ) {
      int i, data;
      if ( full( q ) == 1 )
          printf( "\nQueue is Full" );
      else {
          printf( "\nEnqueue Integer : " );
          scanf( "%d", &amp;data );
          q-&gt;list[q-&gt;tail] = data;
          q-&gt;tail++;
      }
  }
  
  void dequeue( queue *q ) {
      int i;
      if ( empty( q ) == 1 )
          printf( "\n Queue is Empty" );
      else
          q-&gt;head++;
  }
  
  void main( ) {
      int select;
      queue q;
  
      create( &amp;q );
  
      while ( 1 ) {
          printf( "\n1-&gt;Enqueue \t 2-&gt;Dequeue \t 3-&gt;Exit: " );
          scanf( "%d", &amp;select );
  
          switch ( select ) {
          case 1:     enqueue( &amp;q );
                      break;
          case 2:     dequeue( &amp;q );
                      break;
          default:    goto out;
          }
      }
  out:
      exit( EXIT_SUCCESS );
  }
  </code></pre>
  
  <p>Thats my code, the dequeue function returns queue is empty at first, but after I enqueue an integer, it wont dequeue at all. Thanks for your help. I'm using codeblock to compile my program.                                                                     </p>