Count N queen problem

whats the problem in this code
#include
#include
using namespace std;
bitset<30> col,d1,d2;
void solve(int r,int n,int *ans){
if(r==n){
*ans++;
return ;
}
for(int c=0;c<n;c++){
if(!col[c] && !d1[r-c+n-1] && !d2[r+c]){
col[c]=d1[r-c+n-1]=d2[r+c]=1;
solve(r+1,n,ans);
col[c]=d1[r-c+n-1]=d2[r+c]=0;
}
}

}

int main() {
int n;
cin>>n;
int ans=0;
solve(0,n,&ans);
cout<<ans;

return 0;

}

change *ans++ to (*ans)++.
thanks

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.