-4 is a typo.Its 4

I changed char to int func
still no difference- same values :(

second scanf seems to be non working and i don't get it...

printf("Please select a finishing position for a figure for instance E4\n");
		scanf("%c %d",&c1,&y0);
		printf("%c\n",c1);
				if(c1=='Q')//Exit chess
		                  {
                          printf("Thank you and goodbye\n");
                          return 0;
                          }
         else
         {

        x2=char_to_int(c1);
		 printf("%d\n",x2);
         printf("%d\n",y0);
		y2=y0-1;
         }

i think it might be a problem:
I started to play with int_to_char

#include<stdio.h>
  int char_to_int(char c);

  int main()
  {
  int i;
  char c,c1,c2,c3;
  printf("enter a char\n");
  scanf("%c",&c);
  i=char_to_int(c);
  printf("the number of column is:%d\n",i);
   printf("enter a char\n");
    scanf("%c",&c1);
    i=char_to_int(c1);
  printf("the number of column is:%d\n",i);
   printf("enter a char\n");
  scanf("%c",&c2);
  i=char_to_int(c2);
  printf("the number of column is:%d\n",i);
   printf("enter a char\n");
  scanf("%c",&c3);
  i=char_to_int(c3);
  printf("the number of column is:%d\n",i);
  return 0;



}


  int char_to_int(char c)
    {

        int x;
        while(c!='Q')
               {
                    if((c!='A')||(c!='B')||(c!='C')||(c!='D')||(c!='E')||(c!='F')||(c!='G')||(c!='H'))
                       {
                       x=c-'A';//A will be converted to 0, B to 1, etc...
                       return x;
                       }
                       }

}

Try to run it maybe you'll get it... Thanx

printf("Please select a finishing position for a figure for instance E4\n");
scanf("%c %d",&c1,&y0);
printf("%c\n",c1);

AGAIN you ended up giving a space here.

printf("Please select a finishing position for a figure for instance E4\n");
scanf("%c %d",&c1,&y0);
printf("%c\n",c1);

Again you ended up putting a space between your format specifiers in scanf.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.