No value is being printed inside if condition block. Where is the logical error? Thanks.
#include<bits/stdc++.h>
using namespace std;
int fx[]= {-1,-1,-1,0,1,1,1,0};
int fy[]= {-1,0,1,1,1,0,-1,-1};
int ar[20][20];
int n;
int v1, v2;
void fun(int a, int b)
{
    for(int i=0; i<8; i++)
    {
        v1 = a+fx[i];
        v2 = b+fy[i];
        //cout<<v1<<" "<<v2<<endl;
        if(v1>=0 && v1<n)
        {
            if(v2>=0 && v2<n)
            {
               // Not executing 
               cout<<"----------"<<endl;
               cout<<v1<<" "<<v2<<endl;
            }
        }
    }
}
int main()
{
    int n;
    cin>> n;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
            cin>> ar[i][j];
    }
    fun(0,1);
    return 0;
}
SAMPLE INPUT:
 
4
 
1 1 1 1
 
1 1 1 1
 
1 1 1 1
 
1 1 1 1
 
EXPECTED OUTPUT:
---------
0 2
 
1 2
 
1 1
 
1 0
 
0 0
 
 
    