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 |
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }
write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30
Is the following code legal? struct a { int x; struct a *b; }
char *someFun() { char *temp = “string constant"; return temp; } int main() { puts(someFun()); }
How will you print % character? a. printf(“\%”) b. printf(“\\%”) c. printf(“%%”) d. printf(“\%%”)
Write, efficient code for extracting unique elements from a sorted list of array. e.g. (1, 1, 3, 3, 3, 5, 5, 5, 9, 9, 9, 9) -> (1, 3, 5, 9).
13 Answers Intel, Microsoft, TCS,
main() { show(); } void show() { printf("I'm the greatest"); }
Print an integer using only putchar. Try doing it without using extra storage.
main() { int a[10]; printf("%d",*a+1-*a+3); }
posted by surbhi just now main() { float a = 5.375; char *p; int i; p=(char*)&a; for(i=0;i<=3;i++) printf("%02x",(unsigned char) p[i]); } how is the output of this program is :: 0000ac40 please let me know y this output has come
Under linux environment can u please provide a c code for computing sum of series 1-2+3-4+5......n terms and -1+2-3+4-5...n terms..
main() { printf("%d", out); } int out=100;