Queue implementation and array resizing using C++ The 2019 Stack Overflow Developer Survey Results Are InWhat are the differences between a pointer variable and a reference variable in C++?How can I profile C++ code running on Linux?The Definitive C++ Book Guide and ListWhy can templates only be implemented in the header file?What is the effect of extern “C” in C++?What is the “-->” operator in C++?Easiest way to convert int to string in C++C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?Why is reading lines from stdin much slower in C++ than Python?Why is it faster to process a sorted array than an unsorted array?
Is "plugging out" electronic devices an American expression?
Spanish for "widget"
What is the use of option -o in the useradd command?
Patience, young "Padovan"
Is this food a bread or a loaf?
How was Skylab's orbit inclination chosen?
Why is Grand Jury testimony secret?
How are circuits which use complex ICs normally simulated?
"What time...?" or "At what time...?" - what is more grammatically correct?
If the Wish spell is used to duplicate the effect of Simulacrum, are existing duplicates destroyed?
"Riffle" two strings
Can't find the latex code for the ⍎ (down tack jot) symbol
Should I write numbers in words or as numerals when there are multiple next to each other?
What tool would a Roman-age civilization have to grind silver and other metals into dust?
How can I create a character who can assume the widest possible range of creature sizes?
How to make payment on the internet without leaving a money trail?
Access elements in std::string where positon of string is greater than its size
Can distinct morphisms between curves induce the same morphism on singular cohomology?
Time travel alters history but people keep saying nothing's changed
How can I fix this gap between bookcases I made?
Where to refill my bottle in India?
On the insanity of kings as an argument against monarchy
Geography at the pixel level
Are USB sockets on wall outlets live all the time, even when the switch is off?
Queue implementation and array resizing using C++
The 2019 Stack Overflow Developer Survey Results Are InWhat are the differences between a pointer variable and a reference variable in C++?How can I profile C++ code running on Linux?The Definitive C++ Book Guide and ListWhy can templates only be implemented in the header file?What is the effect of extern “C” in C++?What is the “-->” operator in C++?Easiest way to convert int to string in C++C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?Why is reading lines from stdin much slower in C++ than Python?Why is it faster to process a sorted array than an unsorted array?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
The code is supposed to do queue functions which I got right.
The only problem I am having is: I am supposed to double the array size to twice its original size once the array gets completely filled.
I have coded for it but still getting garbage values when I try to put in more values than the original array size. So the problem seems to be in the inc() function below:
#ifndef Q_H_
#define Q_H_
#include <iostream>
using namespace std;
template <class elemType>
class arrayQueue
int size;
int *array;
int front;
int back;
int count;
public:
arrayQueue(elemType size)
this->size = size;
array = new int[size];
front = 0;
back = -1;
count=0;
bool isEmpty()
return (max()==0);
bool isFull()
return (max()==size);
void enqueue(elemType entry)
cout << "enqueue " << entry;
if(isEmpty())
front = back = 0;
array[back] = entry;
count++;
else
back = (back+1) % size;
array[back] = entry;
count++;
cout << endl;
int maxsize()
return count;
void dequeue()
cout << "dequeue : " << Front();
if(isEmpty())
cout << " error : empty";
else if(back == front)
back = front = -1;
else
front = (front+1) % size;
count--;
cout << endl;
void print()
if(isEmpty())
cout << "Queue is empty";
else
for(int i = front; i<count; i++)
cout << array[i] << " ";
cout << array[back];
//cout<<"count is:" <<count<<endl;
cout << endl;
int Front()
if(front == -1)
cout<<"Queue is emptyn";
return -1;
return array[front];
int Back()
if(back==-1)
cout<<"Queue is full";
return array[back];
int max()
return count;
cout <<"count: " <<count;
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
for (int i=0; i<this->count;i++)
temp[i]=this->array[(front+i) % size];
delete [] this->array;
this->array=temp;
this->count=newsize;
// front=array[front]; //0
//front = 0;
//back=count;
;
#endif /* Q_H_ */
I would really appreciate help with this.
c++
add a comment |
The code is supposed to do queue functions which I got right.
The only problem I am having is: I am supposed to double the array size to twice its original size once the array gets completely filled.
I have coded for it but still getting garbage values when I try to put in more values than the original array size. So the problem seems to be in the inc() function below:
#ifndef Q_H_
#define Q_H_
#include <iostream>
using namespace std;
template <class elemType>
class arrayQueue
int size;
int *array;
int front;
int back;
int count;
public:
arrayQueue(elemType size)
this->size = size;
array = new int[size];
front = 0;
back = -1;
count=0;
bool isEmpty()
return (max()==0);
bool isFull()
return (max()==size);
void enqueue(elemType entry)
cout << "enqueue " << entry;
if(isEmpty())
front = back = 0;
array[back] = entry;
count++;
else
back = (back+1) % size;
array[back] = entry;
count++;
cout << endl;
int maxsize()
return count;
void dequeue()
cout << "dequeue : " << Front();
if(isEmpty())
cout << " error : empty";
else if(back == front)
back = front = -1;
else
front = (front+1) % size;
count--;
cout << endl;
void print()
if(isEmpty())
cout << "Queue is empty";
else
for(int i = front; i<count; i++)
cout << array[i] << " ";
cout << array[back];
//cout<<"count is:" <<count<<endl;
cout << endl;
int Front()
if(front == -1)
cout<<"Queue is emptyn";
return -1;
return array[front];
int Back()
if(back==-1)
cout<<"Queue is full";
return array[back];
int max()
return count;
cout <<"count: " <<count;
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
for (int i=0; i<this->count;i++)
temp[i]=this->array[(front+i) % size];
delete [] this->array;
this->array=temp;
this->count=newsize;
// front=array[front]; //0
//front = 0;
//back=count;
;
#endif /* Q_H_ */
I would really appreciate help with this.
c++
1
Ininc
you don’t updatethis->size
– Johnny Mopp
Mar 22 at 2:21
add a comment |
The code is supposed to do queue functions which I got right.
The only problem I am having is: I am supposed to double the array size to twice its original size once the array gets completely filled.
I have coded for it but still getting garbage values when I try to put in more values than the original array size. So the problem seems to be in the inc() function below:
#ifndef Q_H_
#define Q_H_
#include <iostream>
using namespace std;
template <class elemType>
class arrayQueue
int size;
int *array;
int front;
int back;
int count;
public:
arrayQueue(elemType size)
this->size = size;
array = new int[size];
front = 0;
back = -1;
count=0;
bool isEmpty()
return (max()==0);
bool isFull()
return (max()==size);
void enqueue(elemType entry)
cout << "enqueue " << entry;
if(isEmpty())
front = back = 0;
array[back] = entry;
count++;
else
back = (back+1) % size;
array[back] = entry;
count++;
cout << endl;
int maxsize()
return count;
void dequeue()
cout << "dequeue : " << Front();
if(isEmpty())
cout << " error : empty";
else if(back == front)
back = front = -1;
else
front = (front+1) % size;
count--;
cout << endl;
void print()
if(isEmpty())
cout << "Queue is empty";
else
for(int i = front; i<count; i++)
cout << array[i] << " ";
cout << array[back];
//cout<<"count is:" <<count<<endl;
cout << endl;
int Front()
if(front == -1)
cout<<"Queue is emptyn";
return -1;
return array[front];
int Back()
if(back==-1)
cout<<"Queue is full";
return array[back];
int max()
return count;
cout <<"count: " <<count;
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
for (int i=0; i<this->count;i++)
temp[i]=this->array[(front+i) % size];
delete [] this->array;
this->array=temp;
this->count=newsize;
// front=array[front]; //0
//front = 0;
//back=count;
;
#endif /* Q_H_ */
I would really appreciate help with this.
c++
The code is supposed to do queue functions which I got right.
The only problem I am having is: I am supposed to double the array size to twice its original size once the array gets completely filled.
I have coded for it but still getting garbage values when I try to put in more values than the original array size. So the problem seems to be in the inc() function below:
#ifndef Q_H_
#define Q_H_
#include <iostream>
using namespace std;
template <class elemType>
class arrayQueue
int size;
int *array;
int front;
int back;
int count;
public:
arrayQueue(elemType size)
this->size = size;
array = new int[size];
front = 0;
back = -1;
count=0;
bool isEmpty()
return (max()==0);
bool isFull()
return (max()==size);
void enqueue(elemType entry)
cout << "enqueue " << entry;
if(isEmpty())
front = back = 0;
array[back] = entry;
count++;
else
back = (back+1) % size;
array[back] = entry;
count++;
cout << endl;
int maxsize()
return count;
void dequeue()
cout << "dequeue : " << Front();
if(isEmpty())
cout << " error : empty";
else if(back == front)
back = front = -1;
else
front = (front+1) % size;
count--;
cout << endl;
void print()
if(isEmpty())
cout << "Queue is empty";
else
for(int i = front; i<count; i++)
cout << array[i] << " ";
cout << array[back];
//cout<<"count is:" <<count<<endl;
cout << endl;
int Front()
if(front == -1)
cout<<"Queue is emptyn";
return -1;
return array[front];
int Back()
if(back==-1)
cout<<"Queue is full";
return array[back];
int max()
return count;
cout <<"count: " <<count;
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
for (int i=0; i<this->count;i++)
temp[i]=this->array[(front+i) % size];
delete [] this->array;
this->array=temp;
this->count=newsize;
// front=array[front]; //0
//front = 0;
//back=count;
;
#endif /* Q_H_ */
I would really appreciate help with this.
c++
c++
edited Mar 22 at 2:26
Strom
2,498524
2,498524
asked Mar 22 at 2:16
AyushAyush
31
31
1
Ininc
you don’t updatethis->size
– Johnny Mopp
Mar 22 at 2:21
add a comment |
1
Ininc
you don’t updatethis->size
– Johnny Mopp
Mar 22 at 2:21
1
1
In
inc
you don’t update this->size
– Johnny Mopp
Mar 22 at 2:21
In
inc
you don’t update this->size
– Johnny Mopp
Mar 22 at 2:21
add a comment |
2 Answers
2
active
oldest
votes
three small changes:
enqueue method: inc when isFull
if (isFull())
inc();print method: print every element from front to back
inc method: copy every element from front to back, and reset front and back index
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
// ******* IMPORTANT ******
// copy count elements
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
temp[i] = array[index];
front = 0;
back = count - 1;
delete []array;
array=temp;
count=newsize;
template <class elemType>
class arrayQueue
int size;
int *array;
int front;
int back;
int count;
public:
arrayQueue(elemType size)
this->size = size;
array = new int[size];
front = 0;
back = -1;
count=0;
bool isEmpty()
return (max()==0);
bool isFull()
return (max()==size);
void enqueue(elemType entry)
cout << "enqueue " << entry;
if(isEmpty())
front = back = 0;
array[back] = entry;
count++;
else
if (isFull())
inc();
back = (back+1) % size;
array[back] = entry;
count++;
cout << endl;
int maxsize()
return count;
void dequeue()
cout << "dequeue : " << Front();
if(isEmpty())
cout << " error : empty";
else if(back == front)
back = front = -1;
else
front = (front+1) % size;
count--;
cout << endl;
void print()
if(isEmpty())
cout << "Queue is empty";
else
// ******* IMPORTANT ******
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
cout << array[index] << " ";
//cout<<"count is:" <<count<<endl;
cout << endl;
int Front()
if(front == -1)
cout<<"Queue is emptyn";
return -1;
return array[front];
int Back()
if(back==-1)
cout<<"Queue is full";
return array[back];
int max()
return count;
cout <<"count: " <<count;
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
// ******* IMPORTANT ******
// copy count elements
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
temp[i] = array[index];
front = 0;
back = count - 1;
delete []array;
array = temp;
count = newsize;
;
add a comment |
Since you move elements to the beginning of the newly allocated array, inc
needs to update front
and back
to refer to their respective new positions.
Also, you're updating count
to be the new size instead of size
.
Where should back refer to in this case?
– Ayush
Mar 22 at 3:00
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55291935%2fqueue-implementation-and-array-resizing-using-c%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
three small changes:
enqueue method: inc when isFull
if (isFull())
inc();print method: print every element from front to back
inc method: copy every element from front to back, and reset front and back index
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
// ******* IMPORTANT ******
// copy count elements
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
temp[i] = array[index];
front = 0;
back = count - 1;
delete []array;
array=temp;
count=newsize;
template <class elemType>
class arrayQueue
int size;
int *array;
int front;
int back;
int count;
public:
arrayQueue(elemType size)
this->size = size;
array = new int[size];
front = 0;
back = -1;
count=0;
bool isEmpty()
return (max()==0);
bool isFull()
return (max()==size);
void enqueue(elemType entry)
cout << "enqueue " << entry;
if(isEmpty())
front = back = 0;
array[back] = entry;
count++;
else
if (isFull())
inc();
back = (back+1) % size;
array[back] = entry;
count++;
cout << endl;
int maxsize()
return count;
void dequeue()
cout << "dequeue : " << Front();
if(isEmpty())
cout << " error : empty";
else if(back == front)
back = front = -1;
else
front = (front+1) % size;
count--;
cout << endl;
void print()
if(isEmpty())
cout << "Queue is empty";
else
// ******* IMPORTANT ******
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
cout << array[index] << " ";
//cout<<"count is:" <<count<<endl;
cout << endl;
int Front()
if(front == -1)
cout<<"Queue is emptyn";
return -1;
return array[front];
int Back()
if(back==-1)
cout<<"Queue is full";
return array[back];
int max()
return count;
cout <<"count: " <<count;
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
// ******* IMPORTANT ******
// copy count elements
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
temp[i] = array[index];
front = 0;
back = count - 1;
delete []array;
array = temp;
count = newsize;
;
add a comment |
three small changes:
enqueue method: inc when isFull
if (isFull())
inc();print method: print every element from front to back
inc method: copy every element from front to back, and reset front and back index
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
// ******* IMPORTANT ******
// copy count elements
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
temp[i] = array[index];
front = 0;
back = count - 1;
delete []array;
array=temp;
count=newsize;
template <class elemType>
class arrayQueue
int size;
int *array;
int front;
int back;
int count;
public:
arrayQueue(elemType size)
this->size = size;
array = new int[size];
front = 0;
back = -1;
count=0;
bool isEmpty()
return (max()==0);
bool isFull()
return (max()==size);
void enqueue(elemType entry)
cout << "enqueue " << entry;
if(isEmpty())
front = back = 0;
array[back] = entry;
count++;
else
if (isFull())
inc();
back = (back+1) % size;
array[back] = entry;
count++;
cout << endl;
int maxsize()
return count;
void dequeue()
cout << "dequeue : " << Front();
if(isEmpty())
cout << " error : empty";
else if(back == front)
back = front = -1;
else
front = (front+1) % size;
count--;
cout << endl;
void print()
if(isEmpty())
cout << "Queue is empty";
else
// ******* IMPORTANT ******
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
cout << array[index] << " ";
//cout<<"count is:" <<count<<endl;
cout << endl;
int Front()
if(front == -1)
cout<<"Queue is emptyn";
return -1;
return array[front];
int Back()
if(back==-1)
cout<<"Queue is full";
return array[back];
int max()
return count;
cout <<"count: " <<count;
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
// ******* IMPORTANT ******
// copy count elements
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
temp[i] = array[index];
front = 0;
back = count - 1;
delete []array;
array = temp;
count = newsize;
;
add a comment |
three small changes:
enqueue method: inc when isFull
if (isFull())
inc();print method: print every element from front to back
inc method: copy every element from front to back, and reset front and back index
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
// ******* IMPORTANT ******
// copy count elements
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
temp[i] = array[index];
front = 0;
back = count - 1;
delete []array;
array=temp;
count=newsize;
template <class elemType>
class arrayQueue
int size;
int *array;
int front;
int back;
int count;
public:
arrayQueue(elemType size)
this->size = size;
array = new int[size];
front = 0;
back = -1;
count=0;
bool isEmpty()
return (max()==0);
bool isFull()
return (max()==size);
void enqueue(elemType entry)
cout << "enqueue " << entry;
if(isEmpty())
front = back = 0;
array[back] = entry;
count++;
else
if (isFull())
inc();
back = (back+1) % size;
array[back] = entry;
count++;
cout << endl;
int maxsize()
return count;
void dequeue()
cout << "dequeue : " << Front();
if(isEmpty())
cout << " error : empty";
else if(back == front)
back = front = -1;
else
front = (front+1) % size;
count--;
cout << endl;
void print()
if(isEmpty())
cout << "Queue is empty";
else
// ******* IMPORTANT ******
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
cout << array[index] << " ";
//cout<<"count is:" <<count<<endl;
cout << endl;
int Front()
if(front == -1)
cout<<"Queue is emptyn";
return -1;
return array[front];
int Back()
if(back==-1)
cout<<"Queue is full";
return array[back];
int max()
return count;
cout <<"count: " <<count;
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
// ******* IMPORTANT ******
// copy count elements
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
temp[i] = array[index];
front = 0;
back = count - 1;
delete []array;
array = temp;
count = newsize;
;
three small changes:
enqueue method: inc when isFull
if (isFull())
inc();print method: print every element from front to back
inc method: copy every element from front to back, and reset front and back index
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
// ******* IMPORTANT ******
// copy count elements
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
temp[i] = array[index];
front = 0;
back = count - 1;
delete []array;
array=temp;
count=newsize;
template <class elemType>
class arrayQueue
int size;
int *array;
int front;
int back;
int count;
public:
arrayQueue(elemType size)
this->size = size;
array = new int[size];
front = 0;
back = -1;
count=0;
bool isEmpty()
return (max()==0);
bool isFull()
return (max()==size);
void enqueue(elemType entry)
cout << "enqueue " << entry;
if(isEmpty())
front = back = 0;
array[back] = entry;
count++;
else
if (isFull())
inc();
back = (back+1) % size;
array[back] = entry;
count++;
cout << endl;
int maxsize()
return count;
void dequeue()
cout << "dequeue : " << Front();
if(isEmpty())
cout << " error : empty";
else if(back == front)
back = front = -1;
else
front = (front+1) % size;
count--;
cout << endl;
void print()
if(isEmpty())
cout << "Queue is empty";
else
// ******* IMPORTANT ******
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
cout << array[index] << " ";
//cout<<"count is:" <<count<<endl;
cout << endl;
int Front()
if(front == -1)
cout<<"Queue is emptyn";
return -1;
return array[front];
int Back()
if(back==-1)
cout<<"Queue is full";
return array[back];
int max()
return count;
cout <<"count: " <<count;
void inc()
int newsize = this->size*2;
elemType *temp = new elemType[newsize];
// ******* IMPORTANT ******
// copy count elements
for (int i = 0; i < count; ++i)
int index = (front + i) % size;
temp[i] = array[index];
front = 0;
back = count - 1;
delete []array;
array = temp;
count = newsize;
;
answered Mar 22 at 2:51
pexeerpexeer
40028
40028
add a comment |
add a comment |
Since you move elements to the beginning of the newly allocated array, inc
needs to update front
and back
to refer to their respective new positions.
Also, you're updating count
to be the new size instead of size
.
Where should back refer to in this case?
– Ayush
Mar 22 at 3:00
add a comment |
Since you move elements to the beginning of the newly allocated array, inc
needs to update front
and back
to refer to their respective new positions.
Also, you're updating count
to be the new size instead of size
.
Where should back refer to in this case?
– Ayush
Mar 22 at 3:00
add a comment |
Since you move elements to the beginning of the newly allocated array, inc
needs to update front
and back
to refer to their respective new positions.
Also, you're updating count
to be the new size instead of size
.
Since you move elements to the beginning of the newly allocated array, inc
needs to update front
and back
to refer to their respective new positions.
Also, you're updating count
to be the new size instead of size
.
answered Mar 22 at 2:20
1201ProgramAlarm1201ProgramAlarm
17.9k52740
17.9k52740
Where should back refer to in this case?
– Ayush
Mar 22 at 3:00
add a comment |
Where should back refer to in this case?
– Ayush
Mar 22 at 3:00
Where should back refer to in this case?
– Ayush
Mar 22 at 3:00
Where should back refer to in this case?
– Ayush
Mar 22 at 3:00
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55291935%2fqueue-implementation-and-array-resizing-using-c%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
In
inc
you don’t updatethis->size
– Johnny Mopp
Mar 22 at 2:21