fork download
  1. #define YES 10
  2. #define NO 20
  3. using namespace std;
  4. #include <iostream>
  5.  
  6. struct Node
  7. {
  8. Node ** children;
  9. int childCount;
  10. char name[1];
  11. int empty;//YES or NO
  12. int sequence;
  13. double value;
  14. };
  15.  
  16. using namespace std;
  17.  
  18. bool isEmpty(Node ** ptr, int bsize) {
  19. for (int i = 0; i<bsize; i++) {
  20. for (int j = 0; j < bsize; j++) {
  21. if(ptr[i][j].empty == YES){
  22. return true;
  23. }
  24. }
  25. }
  26. return false;
  27. }
  28.  
  29. int main (int argc, const char * argv[])
  30. {
  31. int size = 4;
  32. Node ** tree = new Node * [size];
  33. for (int i = 0; i < size; ++i) tree[i] = new Node[size];
  34. // some stuff
  35. if (isEmpty(tree, size)) {
  36. cout<<"this is empty\n";
  37. return 0;
  38. }
  39. return 0;
  40. }
Success #stdin #stdout 0.02s 2852KB
stdin
Standard input is empty
stdout

Standard output is empty