#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
#include<math.h>
#define TRUE 1
#define FALSE 0
int t=1;
int place(int k,int n);
int queen(int k,int n);
int x[5];//index for column and value at that index is row number
int place(int k,int n)
{
int j;
for(j=1;j<k;j++)
{
if((x[j]==x[k])||(k-j)==abs(x[j]-x[k]))
{
//printf("hi\n");
t=0;
return t;
}
else
{
//printf("hello");
t=1;
return t;
}
}
}
int queen(int k,int n)
{
int j;//here it is row loop index
int a;
int t=5;
for(j=1;j<=4;j++)
{
//t=place(k,j);
//printf("%d",t);
//t=place(k,n);
//printf("%d",t);
if(t==1)
{
x[k]=j;
if(k==n)
{
for(a=1;a<=n;a++)
printf("%d",x[a]);
printf("\n");
return 0;
}
else
{
//printf("%d",x[j]);
queen(k+1,n);
}
}
}
}
int main()
{
static int n=4;
int i;
queen(1,n);
}
hello there are various useless printf statement not of use plzz just ignore and try to give me the correct solution through this code (MEANS THE BACTRACKING APPRAOCH)plzz tell me what i have done wrong with this code so that i am not getting correct value from function place i am new to programming