Push to QStack : QStack « Qt « C++






Push to QStack

  

#include <QStack>
#include <QDebug>

int main()
{
  QStack<int> stack;
  stack.push(1);
  stack.push(2);
  stack.push(3);
  while (!stack.isEmpty())
    qDebug() << stack.pop(); // output: 3, 2, 1
  return 0;
}

   
    
  








Related examples in the same category

1.Create int QStack
2.Push value to QStack, and pop out
3.QStack of QString
4.is QStack empty