The code below is supposed to fill a 10 x 10 character array with the element '.' and then walk through the matrix randomly using the rand() function printing the alphabet along with the movement. There's nothing random about what's priniting for me. In fact, this is all I get no matter how many times I compile and run:

D A . . . . . . . .
C B . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .




Code:
#include <stdio.h>
#include <stdlib.h>

int main()
{
    // main declarations
    char matrix[10][10], *cursor, *start;
    int direction;
    unsigned char elem = 'A';
    
    
    
    
    // fill the matrix elements with .
    for (cursor = &matrix[0][0]; cursor <= &matrix[9][9]; cursor++)
    {
        *cursor = '.';
    }
    
    
    
    
    // walk randomly through the matrix, printing the alphabet in order as we go
    start = cursor = &matrix[0][0];
    while (elem < 91)
    {
        direction = rand() % 4;
        switch (direction)
        {
            Up:
            case 0:
                if ((*(cursor+1) != '.') && (*(cursor-1) != '.') && (*(cursor+10) != '.') && (*(cursor-10) != '.'))
                    goto printMatrix;
                
                if (cursor > (start + 9))
                    cursor -= 10;
                else goto Right;
                    
                if (*cursor == '.')
                    *cursor = elem;
                else
                {
                    cursor += 10;
                    goto Right;    
                }
                
                break;
                
            
            Right:    
            case 1:
                if ((*(cursor+1) != '.') && (*(cursor-1) != '.') && (*(cursor+10) != '.') && (*(cursor-10) != '.'))
                    goto printMatrix;
                
                if ((cursor != &matrix[0][9]) || (cursor != &matrix[1][9]) || (cursor != &matrix[2][9]) || (cursor != &matrix[3][9]) || (cursor != &matrix[4][9]) || (cursor != &matrix[5][9]) || (cursor != &matrix[6][9]) || (cursor != &matrix[7][9]) || (cursor != &matrix[8][9]) || (cursor != &matrix[9][9]))
                    cursor++;
                else goto Left;
                
                if (*cursor == '.')
                    *cursor = elem;
                else
                {
                    cursor--;
                    goto Left;    
                } 
                
                break;
                
            
            Left:    
            case 2:
                if ((*(cursor+1) != '.') && (*(cursor-1) != '.') && (*(cursor+10) != '.') && (*(cursor-10) != '.'))
                    goto printMatrix;
                
                if ((cursor != &matrix[0][0]) || (cursor != &matrix[1][0]) || (cursor != &matrix[2][0]) || (cursor != &matrix[3][0]) || (cursor != &matrix[4][0]) || (cursor != &matrix[5][0]) || (cursor != &matrix[6][0]) || (cursor != &matrix[7][0]) || (cursor != &matrix[8][0]) || (cursor != &matrix[9][0]))
                    cursor--;
                else goto Down;
                
                if (*cursor == '.')
                    *cursor = elem;
                else
                {
                    cursor++;
                    goto Down;    
                } 
                
                break;
                
            
            Down:    
            case 3:
                if ((*(cursor+1) != '.') && (*(cursor-1) != '.') && (*(cursor+10) != '.') && (*(cursor-10) != '.'))
                    goto printMatrix;
                
                if (cursor < (start + 90))
                    cursor += 10;
                else goto Up;
                
                if (*cursor == '.')
                    *cursor = elem;
                else
                {
                    cursor -= 10;
                    goto Up;    
                } 
                
                break;
        }
        elem++;
    }
    
    
    
    
    // print the matrix
    printMatrix:
        for (int i = 0, j = 0; i < 10; i++)
        {
            for (j = 0; j < 10; j++)
            {
                printf("%c ", matrix[i][j]);
            }
            printf("\n");
        }
        
        
        
        
    // end main
    return 0;
}