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 Posted / 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 |
Post New Answer View All Answers
What are the benefits of organizational structure?
int i=10; printf("%d %d %d", i, i=20, i);
Why can’t we compare structures?
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?
What is selection sort in c?
please explain every phase in the "SDLC" in the dotnet.
What is this pointer in c plus plus?
Describe newline escape sequence with a sample program?
What is operator promotion?
Combinations of fibanocci prime series
What is difference between main and void main?
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel
What is omp_num_threads?
What is methods in c?