write a program in c language to get the value of arroy
keys pressed and display the message which arrow key is
pressed?



write a program in c language to get the value of arroy keys pressed and display the message which..

Answer / mohamed ziavudeen

#define KBHOME 327
#define KBEND 335
#define KBUP 328
#define KBDOWN 336
#define KBPGUP 329
#define KBPGDN 337
#define KBLEFT 331
#define KBINS 338
#define KBRIGHT 333
#define KBDEL 339

c0 = getch();
if (c0==0) {
c1=getch()+256;
if (c1==KBUP)
{
printf("You had hit the upper arrow key");
else if (c1==KBDOWN)
printf("You had hit the DOWN arrow key");
else if (c1==KBLEFT)
printf("You had hit the LEFT arrow key");
else if(c1==KBRIGHT)
printf("You had hit the RIGHT arrow key");
else
printf("You had hit some other key");
}
}

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Code Interview Questions

How will u find whether a linked list has a loop or not?

8 Answers   Microsoft,


main() { extern int i; i=20; printf("%d",i); }

1 Answers   Value Labs,


main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }

2 Answers   CSS, Wipro,


main() { int i; float *pf; pf = (float *)&i; *pf = 100.00; printf("\n %d", i); } a. Runtime error. b. 100 c. Some Integer not 100 d. None of the above

2 Answers   HCL, LG,


int main() { int x=10; printf("x=%d, count of earlier print=%d", x,printf("x=%d, y=%d",x,--x)); getch(); } ================================================== returns error>> ld returned 1 exit status =================================================== Does it have something to do with printf() inside another printf().

1 Answers  






to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD

6 Answers   Synergy,


void main() { int const * p=5; printf("%d",++(*p)); }

3 Answers   Infosys, Made Easy, State Bank Of India SBI,


#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }

1 Answers  


#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }

2 Answers   CNSI,


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

0 Answers  


int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }

2 Answers   CSC,


Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.

1 Answers  


Categories