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 |
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
What are .h files and what should I put in them?
Is c is a procedural language?
What is else if ladder?
What is the difference between void main() and int main()?
compare array with pointer?
Write a C program that defines a 2-dimentional integer array called A [50][50]. Then the elements of this array should randomly be initialized either to 1 or 0. The program should then print out all the elements in the diagonal (i.e. a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally, print out how many zeros and ones in the diagonal.
Why c++ is called c++ and not c+?
Write a program to print “hello world” without using semicolon?
Is c is a low level language?
Write a program to identify if a given binary tree is balanced or not.
Between macros and functions,which is better to use and why?