So im programming a poker game (because im bored) and just setting out the classes and testing it works as i go along and its working perfectly BUT suddenly i add some new code to have an actual deck instead of infinite random cards and i just get this error
*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)
This is from a g++ compiler on mint 19.3 cinnamon
I looked at other questions that are similar to mine but they seem to be about large amounts of data and i dont really see how thats in my program.
If someone could help out or at least explain the error message that would be great
-thanks
/ my code /
#include <iostream>
#include <stdlib.h>
using namespace std;
class Card{
public:
    static Card* deck;
    static int current;
    char house;
    char value;
    void setTo(Card c){
        house = c.house;
        value = c.value;
    }
    void random(){
        setTo(*(deck + current));
        current++;
    }
    void print(){
        switch (value){
            case 11:
                cout << "jack";
                break;
            case 12:
                cout << "queen";
                break;
            case 13:
                cout << "king";
                break;
            case 14:
                cout << "ace";
                break;
            default:
                cout << (int)value;
                break;
        }
        cout << " of ";
        switch (house){
            case 0:
                cout << "spades";
                break;
            case 1:
                cout << "clubs";
                break;
            case 2:
                cout << "hearts";
                break;
            case 3:
                cout << "diamonds";
                break;
            default:
                cout << "there has been an error, the house is invalid";
                break;
        }
        cout << endl;
    }
    static void CreateDeck(){
        Card cs[52];
        deck = &cs[0];
        int k;
        for(int i = 0;i<4;i++){
            for(int j = 0;j<14;j++){
                k =  (i*13) + j;
                deck[k].house = i;
                deck[k].value = (j+1);
            }
        }
    }
    static void ShuffleDeck()
        int j,k;
        Card t;
        for(int i = 0;i<52;i++){
            j = rand() % 52;
            k = rand() % 52;
            t.setTo(*(deck+j));
            (*(deck+j)).setTo(*(deck+k));
            (*(deck+k)).setTo(t);
        }
    }
};
class Player{
    public:
        int chips;
        Card* hand;
        string pName;
        void initialize(string n){
            chips = 1000;
            pName = n;
            Card cs[2];
            hand = &cs[0];
        }
        void print(){
            cout << "player: " << pName << endl;
            cout << "    ";
            (*hand).print();
            cout << "    ";
            (*(hand +1)).print();
            cout << "    " << chips << " chips" << endl;
            cout << endl;
        }
        void deal(){
            (*hand).random();
            (*(hand+1)).random();
        }
};
class Game{
    public:
        int pot;
        Card* deck;
        void initialize(){
            pot = 0;
            Card c[5];
            deck = &c[0];
        }
};
Card* Card::deck = NULL;
int Card::current = 0;
int main()
{
    srand (time(NULL));
    Card::CreateDeck();
    Card::ShuffleDeck();
    Card b[2];
    b[0].random();
    b[1].random();
    b[0].print();
    b[1].print();
    cout << endl;
    return 0;
}
 
     
    