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

String copy logic in one line.

11 Answers   Microsoft, NetApp,


main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above

3 Answers   BrickRed, HCL,


main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a. Runtime error. b. I am OK c. Compile error d. I am O

4 Answers   HCL,


write a c program to Create a registration form application by taking the details like username, address, phone number, email along with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 5 users and display the details. In place of password display “****”. (Use Structures).

0 Answers   CDAC, College School Exams Tests,


write a c-program to find gcd using recursive functions

5 Answers   HTC, Infotech,






main() { char *a = "Hello "; char *b = "World"; clrscr(); printf("%s", strcat(a,b)); } a. Hello b. Hello World c. HelloWorld d. None of the above

3 Answers   HCL,


main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit >> (i - (i -1))); } } a. 512, 256, 0, 0, 0 b. 256, 256, 0, 0, 0 c. 512, 512, 512, 512, 512 d. 256, 256, 256, 256, 256

2 Answers   HCL,


Write a complete program that consists of a function that can receive two numbers from a user (M and N) as a parameter. Then print all the numbers between the two numbers including the number itself. If the value of M is smaller than N, print the numbers in ascending flow. If the value of M is bigger than N, print the numbers in descending flow. may i know how the coding look like?

2 Answers  


main() { char *p="GOOD"; char a[ ]="GOOD"; printf("\n sizeof(p) = %d, sizeof(*p) = %d, strlen(p) = %d", sizeof(p), sizeof(*p), strlen(p)); printf("\n sizeof(a) = %d, strlen(a) = %d", sizeof(a), strlen(a)); }

1 Answers  


Write a C program to print look and say sequence? For example if u get the input as 1 then the sequence is 11 21 1211 111221 312211 12112221 .......(it counts the no. of 1s,2s etc which is in successive order) and this sequence is used in run-length encoding.

1 Answers  


write a c program to Create employee record by taking details like name, employee id, address and phone number. While taking the phone number, take either landline or mobile number. Ensure that the phone numbers of the employee are unique. Also display all the details

2 Answers   TCS,


int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); }

1 Answers  


Categories