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 |
pointer_variable=(typecasting datatype*)malloc(sizeof(datatype)); This is the syntax for malloc?Please explain this,how it work with an example?
2 Answers eClerx, Excel, kenexa,
What are directives in c?
how to make a scientific calculater ?
Write a program or provide a pseudo code to flip the 2nd bit of the 32 bit number ! (Phone Screen)
What is && in c programming?
How can you avoid including a header more than once?
fn f(x) { if(x<=0) return; else f(x-1)+x; }
write a program to find the given number is prime or not
2 Answers Accenture, Vasutech,
Write a C program to fill a rectangle using window scrolling
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
What is the meaning of typedef struct in c?
can anyone proide me reading material on svit00ef27@yahoo.com please thanx in advance