How can I cout all combination of shots from Basketball games

  c++, dynamic-programming

I am trying to solve a problem with memset, but I am trying to get the combination of shots that can give me 5.

I don’t know if I am using the memset function correctly to solve a dynamic programming problem, although I have a slight perception that I am. My intention with this code is to get all the combinations that given n, I can receive as a response the combinations of the shots that add up to n.

Like that: for N = 5, (5, 0, 0), (2, 0, 1), (1, 2, 0) (0, 1, 1).

Here is the problem:
Basketball games are a sequence of 2-point shots, 3-point shots, and 1- point free throws. Give an algorithm that computes how many possible mixes (1s,2s,3s) of scoring add up to a given n. For n = 5 there are four possible solutions: (5, 0, 0), (2, 0, 1), (1, 2, 0), and (0, 1, 1).

My actual code

using namespace std;

int main(){
    int n;  //input value of n 
    //pushing 1, 2, 3 in a array
    int arr[3] = {1, 2, 3};
    int dp[n+1];
    memset(dp, 0, sizeof(dp));
    dp[0] = 1;//base case
    for(int i=1;i<=n;i++){
        for(int j=0;j<3;j++){
        dp[i] += dp[i-arr[j]];  

    return 0;

Source: Windows Questions C++