# fifteen initialize not working correctly

so the line of code below gives me the output of:

• 2|3|-4
• -3|-2|-1
• 8|-7|95

Can anyone see what I ve done wrong? Thank you.

``````void init(void)
{
for (int i = 0; i < d; i++)
{
for (int j = 0; j < d; j++)
{
board[i][j] = d^2 - i*d - j - 1;
if (i + 1 == d && j + 1 == d)
board[i][j] = 95;
}
}
if ((d^2 - 1) % 2 != 0)
{
int temp = board[d-1][d-2];
board[d-1][d-2] = board[d-1][d-3];
board[d-1][d-3] = temp;
}
}
``````
• So I got it to work by changing d^2 to d*d. Can anyone please explain why the former is wrong? Also how do I make the underscore symbol using int? I think I can only pass numeric values to int, and since board is an integer variable, how do I make it to show "_"? – Martin Wzatek Mar 21 '16 at 11:45
• Solved the underscore thing thanks to the function that follows initialize(), draw(). So my only question now is why d^2 can not be used. – Martin Wzatek Mar 21 '16 at 12:28

The `^` operator is not an exponent operator as it is in traditional mathematics. It is the BITWISE XOR operator. You weren't actually squaring d. There is no exponent operator. The closest thing to this is the pow(a,b) function ( #include ) that returns a to the power of b.