mercredi 23 décembre 2015

How can I declare a stack reference in C++11?

I am implementing a stack reference. However I got the error of 'Segmentation fault (core dumped)'. I am using g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2 on Ubuntu 14.04. Many thanks.

The code is listed below.

#include<iostream>
#include<stack>

using namespace std;

int main() {
    stack<int>* S;
    S->push(4);
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire