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 |
wht is the difference between KPO and BPO ?
2 Answers Accenture, BPO, HCK, HCL, Infosys,
Heyyy All, Just a challenge . A C program with if Else if(){ /// insert sumthing print ("in if") // insert sumting } else { ///// insert sumthing print ("in else"); //// insert sumthing } can anyone modify it so that program prints. if and else both
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above
What is the difference between a free-standing and a hosted environment?
Differentiate between new and malloc(), delete and free() ?
What are local static variables?
Which node is more powerful and can handle local information processing or graphics processing?
i want to know aptitude questions,technical questions
4.weight conversion: Write a program that will read weight in pounds and convert it into grams.print both the original weight and the converted value.There are 454 grams in a pound.design and carry out a test plan for this program.
Why is c so powerful?
How do you print only part of a string?