I am doing my project to implement a typing tutor application in turbo C compiler (this is the limit), this function is actually a look up table for x,y and key character but it is returning a garbage value at first value of that I passed in argument. From second onwards it starts doing right. Note that that x,y are pointers to return two values at time. Please CHECK what is my mistake.
s1 = "ASDF JKL; ADSF JLK; ";
char take_xy(char s1[], int j, int *x, int *y)
{
char ch;
switch(s1[j])
{
case 'Q' : *x = 137; *y = 244; ch = 'Q'; break;
case 'W' : *x = 160; *y = 244; ch = 'W'; break;
case 'E' : *x = 183; *y = 244; ch = 'E'; break;
case 'R' : *x = 206; *y = 244; ch = 'R'; break;
case 'T' : *x = 229; *y = 244; ch = 'T'; break;
case 'Y' : *x = 252; *y = 244; ch = 'Y'; break;
case 'U' : *x = 275; *y = 244; ch = 'U'; break;
case 'I' : *x = 298; *y = 244; ch = 'I'; break;
case 'O' : *x = 321; *y = 244; ch = 'O'; break;
case 'P' : *x = 344; *y = 244; ch = 'P'; break;
case 'A' : *x = 144; *y = 268; ch = 'A'; break;
case 'S' : *x = 167; *y = 268; ch = 'S'; break;
case 'D' : *x = 190; *y = 268; ch = 'D'; break;
case 'F' : *x = 213; *y = 268; ch = 'F'; break;
case 'G' : *x = 236; *y = 268; ch = 'G'; break;
case 'H' : *x = 259; *y = 268; ch = 'H'; break;
case 'J' : *x = 282; *y = 268; ch = 'J'; break;
case 'K' : *x = 305; *y = 268; ch = 'K'; break;
case 'L' : *x = 328; *y = 268; ch = 'L'; break;
case ';' : *x = 351; *y = 268; ch = ';'; break;
// case ''' : *x = 374; *y = 268; ch = '''; break;
case 'Z' : *x = 162; *y = 292; ch = 'Z'; break;
case 'X' : *x = 185; *y = 292; ch = 'X'; break;
case 'C' : *x = 208; *y = 292; ch = 'C'; break;
case 'V' : *x = 231; *y = 292; ch = 'V'; break;
case 'B' : *x = 254; *y = 292; ch = 'B'; break;
case 'N' : *x = 277; *y = 292; ch = 'N'; break;
case 'M' : *x = 300; *y = 292; ch = 'M'; break;
case '?' : *x = 369; *y = 292; ch = '?'; break;
case ' ' : *x = 189; *y = 316; ch = ' '; break;
}
return ch;
}