What is the purpose of the following code?
Is there any problem with the code?

void send(int count, short *to, short *from) {
/* count > 0 assumed */
register n = (count + 7) / 8;
switch (count % 8)
{
case 0: do { *to = *from++;
case 7: *to = *from++;
case 6: *to = *from++;
case 5: *to = *from++;
case 4: *to = *from++;
case 3: *to = *from++;
case 2: *to = *from++;
case 1: *to = *from++;
}
while (--n > 0);
}
}



What is the purpose of the following code? Is there any problem with the code? void send(int cou..

Answer / Nand Kishore

The given code, `void send(int count, short *to, short *from)`, is designed to copy a sequence of short integers from 'from' to 'to', ensuring that the number of elements copied does not exceed 'count'.nnThere is no apparent problem with the code, assuming that it is part of a larger program and used appropriately.nnThe code uses a register keyword for optimization purposes. This keyword tells the compiler to make the variable 'n' accessible in multiple instructions, potentially improving performance.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

ABCDCBA ABC CBA AB BA A A

4 Answers   TCS,


WRITE A C PROGRAM TO FIND SECOND BIGGEST VALUE FROM THE GIVEN VALUES

1 Answers  


Explain the Difference between the New and Malloc keyword.

1 Answers   InterGraph,


Write a C program to get the desired output. 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 . . . 1 n..............n 1 Note: n is a positive integer entered by the user.

4 Answers  


main() { printf("hello%d",print("QUARK test?")); }

5 Answers  


#define min((a),(b)) ((a)<(b))?(a):(b) main() { int i=0,a[20],*ptr; ptr=a; while(min(ptr++,&a[9])<&a[8]) i=i+1; printf("i=%d\n",i);}

3 Answers  


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

2 Answers  


3. Program to print all possible substrings. ex: String S St Str Stri Strin String t tr tri trin tring r

3 Answers   Huawei,


how to write a cprogram yo get output in the form * *** ***** ******* ********* ******* ***** *** *

3 Answers  


Write a program in c to print * * * * * *******

1 Answers  


what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }

9 Answers  


The __________ attribute is used to announce variables based on definitions of columns in a table?

1 Answers  


Categories