why do i get a wrong answer?

Why am i getting wrong answer for this code?

#include <iostream>

using namespace std;

int main()
{
    int t,n;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        char s[n];
        for(int i=0;i<n;i++)
        {
            cin>>s[i];
        }
        int c=0;
        for(int i=0;i<n;i++)
        {
            if(s[i]=='0' && s[i-1]!='1' && s[i+1]!='1')
            {
                c++;
            }
        }
        printf("%d\n",c);
    }
    return 0;
}

Please post your code in a proper format or use an online ide and give us the link.

//