What is the output of the following code snippet?


void solve() {
   stack<int> s;
   s.push(1);
   s.push(2);
   s.push(3);
   for(int i = 1; i <= 3; i++) {
       cout << s.top() << " ";
       s.pop();
   }
}

Posted on by