I'm trying to make a 2d array filled with the truth table for n amount of variables

ex. 3 variables will create an array that looks like this

0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

i'm having trouble coming up with a recursive algorithm to generate all possible bitstrings.
any help would be appreciated. thanks