I want to initialize a 2D array with -1 as all the value. I used memset()
for this.
#include <bits/stdc++.h>
using namespace std;
int dp[100][100];
memset(dp, -1, sizeof(dp));
int dynamicProgramming(some parameters)
{
//I want to use dp[][] array here
}
int main() {
cout<<dp[99][99];
return 0;
}
But I am getting an error as
prog.cpp:5:7: error: expected constructor, destructor, or type conversion before ‘(’ token
memset(dp, -1, sizeof(dp));
Can you tell me the correct way to do it?