How to return null to a user defined class in c++ -


i have defined queue class works card class have created, function method return supposed return card when called, if there no card should return null. problem keep getting errors when try null, null, , '\0'.

for '\0' char card error, null long card error, strange part null not recognized keyword , ignored.

i wondering if have define null in cards class somehow, or if different issue altogether. here's code using queue class, in case needed:

class queue{     card cards[52];     int first;     int last;     int count;  public:     queue();      void insert(card insert);     card remove();     int getsize(); };  queue::queue(){     first = last = count = 0; }  card queue::remove(){     if(count == 0)         return null;     card temp = cards[last];     last++;     count--;     if (last > 0)         last = 51;     return temp; } 

edit:

class queue{     card *cards; } queue::queue(){     cards = new card[52]; } card queue::remove(){     if(count == 0)         return nullptr; } 


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -