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 |
How does free() know how many bytes to free?
Explain the Difference between the New and Malloc keyword.
Is this program statement valid? INT = 10.50;
what is the structure?
main() { char x; while(x=0;x<=255;x++) printf("\nAscii value %d Charater %c",x,x); }
What is the most efficient way to store flag values?
can you change name of main()?how?
can any one tel me wt is the question pattern for NIC exam
Explain how can I remove the trailing spaces from a string?
What is a macro?
How does memset() work in C?
Does * p ++ increment p or what it points to?