int swap(int *a,int *b)
{
*a=*a+*b;*b=*a-*b;*a=*a-*b;
}
main()
{
int x=10,y=20;
swap(&x,&y);
printf("x= %d y = %d\n",x,y);
}
Answer / susie
Answer :
x = 20 y = 10
Explanation
This is one way of swapping two values. Simple checking will
help understand this.
Is This Answer Correct ? | 4 Yes | 1 No |
Display the time of the system and display the right time of the other country
What are segment and offset addresses?
main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit = (bit >> (i - (i -1)))); } } a. 512, 256, 128, 64, 32 b. 256, 128, 64, 32, 16 c. 128, 64, 32, 16, 8 d. 64, 32, 16, 8, 4
main() { static int var = 5; printf("%d ",var--); if(var) main(); }
main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }
int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); }
how can i cast a char type array to an int type array
int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.
2 Answers Bosch, eInfochips, HCL, IHCL,
void pascal f(int i,int j,int k) { printf(ā%d %d %dā,i, j, k); } void cdecl f(int i,int j,int k) { printf(ā%d %d %dā,i, j, k); } main() { int i=10; f(i++,i++,i++); printf(" %d\n",i); i=10; f(i++,i++,i++); printf(" %d",i); }
what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++i] + ++i +(++i); printf("%d",num); }
Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)
# include <stdio.h> int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); }