#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define max 200005
struct st{
    ll index,freq,val;
}s[max];;
int main(){
    ll t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        ll counter[max]={0};
        for(ll i=1;i<=n;i++){
            ll x;
            cin>>x;
            s[x].val=x;
            s[x].index=i;
            s[x].freq++;
            cout<<s[x].freq<<endl;
        }
        
    }
    return 0;
}
In this code, how I will initialize struct to zero in every while loop. I have tried memset() but It is showing error. Also I created struct object in main function. But the program crashes. Please give me hints to solve the problem.
 
     
    