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 |
What is the output of below code? main() { static int a=5; printf("%3d",a--); if(a) main(); }
What are void pointers in c?
How do you define CONSTANT in C?
Which header file is essential for using strcmp function?
How do I get an accurate error status return from system on ms-dos?
Given an array of length N containing integers between 1 and N, determine if it contains any duplicates.
Write a program in C to print the alphabets in order as on a mobile phone.i.e:When 2 is pressed once 'a' prints and if it is pressed two times 'b' prints and so on.we have to print all the alphabets as on mobile phone like this.
wats SIZE_T meant for?
how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?
What is sparse file?
What is the advantage of c?
write a program to display & create a rational number