why this give error:
{
queue<char[4]> list;
char temp[4];
list.push( temp );
temp = list.front();
}
Printable View
why this give error:
{
queue<char[4]> list;
char temp[4];
list.push( temp );
temp = list.front();
}
because the type of temp is constant pointer.
even if we take the line
{
temp - list.front();
}there is still error..
the error is in pushing line
{
list.push( temp );
}
Well...simply because you cannot use arrays with the STL containers...simply use 'string' instead...
Code:#include <queue>
#include <string>
std::queue<std::string> list;
std::string s("Hello");
list.push(s);
std::string t = list.front();