Holes in the text! Runtime Error!

I have wrote the following code but I am getting a runtime error

#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
    {
            char *s;
            cin >> s;
            int x=0;
            int num=0;
            while(s[x]!='\0')
            {
                if(s[x]=='A'||s[x]=='D'||s[x]=='O'||s[x]=='P'||s[x]=='R'||s[x]=='Q')
                    num=num+1;
                else
                    if(s[x]=='B')
                        num=num+2;
                x++;
            }
            cout << num<<endl;
    }
    return 0;
}

Could anyone help me out!
Thanks!

See your pointer , its wild pointer . Asign it to some memory
like s=new char[SIZE];

1 Like

thanks a lot!