C solution 
ApproachCreate a 2D array that will store the probabilty the knight will be at that position after a number of movesInitialize the knight at the starting posito

# Approach
Create a 2D array that will store the probabilty the knight will be at that position after a number of moves

Initialize the knight at the starting positon with a probability of 1.0 

For each move we will have to calculate all of the 8 possible moves that the knight is able to do. By checking the bounds we can determine if this move is possible and if it is we can adjust the probability of the knight reaching that move.

I did this through simple edge case handling

  if (rowPos >= 0 && rowPos < n && colPos >= 0 && colPos < n){
------new[r][c] += dp[rowPos][colPos] / 8.0;
  }

Then you would idealy free dp and set it equal to the new 2D array and iterate it K times.

I found this problem to be worded incorrectly and its easier to understand it as  "What is the probability the knight can make K moves without stepping off the board?" 

Throughout this problem I allocated space through calloc however memset can just as easily be used

# Complexity
- Time complexity:
O(k * n^2) as we have to create 2D arrays for each instance of k 

- Space complexity:
O(n^2) as we constanty maintain a 2D array to store the probabilities

# Code
```c []
double knightProbability(int n, int k, int row, int column) {
    
    double ** dp = calloc(n, sizeof(double*));
    
    for (int i = 0; i < n; i++) {
        dp[i] = calloc(n, sizeof(double));  
    }

    dp[row][column] = 1.0;

    // all possible moves a knight can do 
    int moves[8][2] = {{-2, -1}, {-2, 1}, {-1, -2}, {-1, 2}, {1, -2}, {1, 2}, {2, -1}, {2, 1}};

    for(int v = 1; v <= k; v++){

        //allocate space for new DP maxtrix that will store the new probabilties
        double ** new = calloc(n, sizeof(double*));
    
        for (int i = 0; i < n; i++) {
            new[i] = calloc(n, sizeof(double));  
        }

        //update the new dp table based on the previous one
        for(int r = 0; r < n; r++){          
            for(int c = 0; c < n; c++){
                for(int i = 0; i < 8; i++){
                    int rowPos = r + moves[i][0];
                    int colPos = c + moves[i][1];

                    //checks if the new position is within bounds 
                    if (rowPos >= 0 && rowPos < n && colPos >= 0 && colPos < n){
                        new[r][c] += dp[rowPos][colPos] / 8.0;
                    }
                }
            }
        }

        // definitely should free dp here but its leetcode so it doesn't matter
        dp = new;
    }
    double ret = 0;
    for (int r = 0; r < n; r++) {
        for (int c = 0; c < n; c++) {
            ret += dp[r][c];
        }
    }

    return ret;

}
```
['C']