title: implementing a queue in a structured approach
body: <p>For my structured approach to making a queue program, I am having a few problems with syntax and array indexs when it comes to pointers. I have marked the lines in which i am having trouble. Are these all a matter of not casting properly or is it a problem in terms of incorrect sytax? </p>
  
  <pre><code>    bool Enqueque(int** queue, int* front, int* rear, int* nElements, int* capacity, 
                    int userInput)
      {   
  
          //if there is no more space in the Queue
          if( *nElements == *capacity )
          {
              //update the capacity
              *capacity = *nElements * 2;
  
              //asked OS for more memory
              int* growQueue = (int*)malloc( (*capacity) * sizeof(int) );
  
              //error checking
              if(growQueue == NULL)
                  return false;
  
              //take all the elements from the original queue and put into the bigger queue  
              for(int i = 0; i&lt;*nElements; i++)
                  growQueue[i] = (*queue)[i];
              free(*queue);
              *queue = growQueue;
  
              (*queue)[*nElements] = userInput;
              nElements++;
  
          }
  
          //if there is space in the queue
          else if(*nElements+1 &gt; *capacity)
          {
              //if queue is empty
               if(front == NULL)
              {
                  //front and rear are both pointers to the same element
  
                  //These two lines are giving warnings
                  //QueueLibrary.c:42:19: warning: assignment makes pointer from //integer without a cast [-Wint-conversion]
    //           front = (*queue)[0];
                     ^
  //QueueLibrary.c:43:18: warning: assignment makes pointer from integer without a //cast [-Wint-conversion]
               //rear = (*queue)[0];
                  front = (*queue)[0];
                  rear = (*queue)[0];
  
  
  
                  (*queue)[0] = userInput;
                  *nElements++;
                  return true;
              }
  
               else if(*nElements &gt;= 1)
               {
                   //move the userInput into the next available spot behind the 
                   //element after rear. 
  
  
  //QueueLibrary.c:54:24: warning: cast from pointer to integer of different size //[-Wpointer-to-int-cast]
  
                (*queue)[ (int)rear+1 ] = userInput;
                   (*queue)[ rear+1 ] = userInput;
  
  
  //Array subscript is not an integer
                   rear = (*queue)[ rear+1 ];
                   return true;
               }
          }    
      }
  </code></pre>