A) It seems you use NULL to assign ‘0’ to int variables. Since NULL is commonly defined as 0, that apparently works. Anyway, you shouldn’t do that: do use 0!
1) NULL was created to explicitly tell: «This pointer is not pointing to an available memory area» - it shouldn’t be used for different purposes.
2) In C++ NULL has been replaced by nullptr - do use nullptr (but only with pointers!).
3) NULL could betray you:
https://channel9.msdn.com/Shows/Going+Deep/Stephan-T-Lavavej-Everything-you-ever-wanted-to-know-about-nullptr
(from minute 16 on - please note that’s a long, technical video)
B) Line 77:
(3 - 1 + 1)
I’m not good at math, but I think 3 - 1 + 1 == 3
C) Before using std::rand() you should initialize std::srand()!
D) After this instruction
int usedBoards[3] = { NULL };
all cells inside usedBoards should be initialized to 0. So, in beginGame(), the if condition is always true:
if (playedBoard[r] == 0) return r;
E) If you generate numbers randomly, why do you define three tables of numbers?