write a function to swap an array a[5] elements like a[0] as
a[5],a[1] as a[4],....a[5] as a[0].without using more than
one loop and use one array not to use temp array?
Answer / ashutosh tiwari
void arr_rev(int *arr, int size)
{
int i;
for(i=0;i<(size/2);i++)
{
if(i==size/2)
break;
*(arr+i) = *(arr+i) + *(arr+(size-i-1));
*(arr+(size-i-1)) = *(arr+i) - *(arr+(size-i-1));
*(arr+i) = *(arr+i) - *(arr+(size-i-1));
}
}
Is This Answer Correct ? | 2 Yes | 0 No |
I need previous papers of CSC.......plz help out by posting them.......
write a c code "if you give a any decimal number then print that number in english alphabet"? ex: i/p: 552 o/p: five hundred fifty two ...
main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } what is the output?
Write a program to check whether a number is prime or not using c?
What is the purpose of 'register' keyword?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
what do you mean by inline function in C?
What is the size of empty structure in c?
what is the output of the following program? 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; } }
How do I read the arrow keys? What about function keys?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
how to create c progarm without void main()?