title: Circular shift a dynamic c array by n elements
body: <p>I have a queue of set length implemented as a dynamic c array implemented like this:</p>
  
  <pre><code>typedef struct {
      float* queue;
      int size;
      int pointer;
  } QueueStruct;
  
  void createQueue(QueueStruct* queueInstance, int size){
      queueInstance-&gt;queue = malloc(sizeof(float)*size);
      queueInstance-&gt;size = size;
      queueInstance-&gt;pointer = 0;
  }
  
  void addElementToQueue(QueueStruct* queueInstance,float element){
      queueInstance-&gt;queue[pointer] = element;
      if (queueInstance-&gt;pointer == queueInstance.size - 1){
          queueInstance-&gt;pointer = 0;
      } else {
          ++queueInstance-&gt;pointer;
      }
  }
  
  void freeQueue(QueueStruct* queueInstance){
      free(queueInstance-&gt;queue);
  }
  </code></pre>
  
  <p>And I want to implement this function:</p>
  
  <pre><code>float* returnQueue(QueueStruct queueInstance){
      //I want this function to malloc a new float* and then put the queue in it in the
      // correct order, from start to finish, as pointed too by the pointer.  
      //Im not sure how to do this.
  }
  </code></pre>
  
  <p>Any help would be appreciated.</p>
  
  <p>Edit: Corrected a silly programming mistake - this is a simplified version of what is actually in my program.  </p>