Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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?



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].wit..

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

Post New Answer

More C Interview Questions

How does free() know how many bytes to free?

8 Answers  


Explain the Difference between the New and Malloc keyword.

0 Answers   InterGraph,


Is this program statement valid? INT = 10.50;

0 Answers  


what is the structure?

4 Answers   TCS,


main() { char x; while(x=0;x<=255;x++) printf("\nAscii value %d Charater %c",x,x); }

2 Answers  


What is the most efficient way to store flag values?

0 Answers  


can you change name of main()?how?

3 Answers   HCL, Siemens,


can any one tel me wt is the question pattern for NIC exam

0 Answers   NIC,


Explain how can I remove the trailing spaces from a string?

0 Answers  


What is a macro?

0 Answers  


How does memset() work in C?

2 Answers  


Does * p ++ increment p or what it points to?

0 Answers  


Categories