• edited by
1,343 views
0 0 votes
swap(int c, int d)
{
    int k,t;
    k=3;
    t=c;
    c=d;
    d=t;
    k=c+d+t;
}
main()
{
    int k=5, l=9;
    swap(k,l);
    printf("%d,%d",k,l);
}
  1. 9,5
  2. 5,9
  3. 5,19
  4. 19,5

2 Answers

Best answer
3 3 votes
$printf$ will print the value which the $swap$ function returns

& we can clearly see that the $swap$ function didn't return anything

So, $printf$ will print the argument of $swap$ i.e. $k=5$, $l=9$
• selected by
Answer:
Position:
Show:

Related questions

1 1 vote
0 0 answers
1.6k
1.6k views
srestha asked May 8, 2019
1,550 views
Consider the following function int fun(int a[ ],int l, int target){ int i=0,j=0,sum=0,count=0; while(j<l){ if(sum<target){ sum=sum+a[j]; j++; } else if(sum>target){ sum=...
2 2 votes
0 0 answers
927
927 views
srestha asked May 4, 2019
927 views
Consider the following program:void A(int n){ printf("*"); if(n>1){ A(n/4); A(n/4); A(n/4); A(n/4); } }Let $X$ be number of asterisks printed by above function when $n=10...
4 4 votes
2 answers 2 answers
3.2k
3.2k views
Gangani_Son asked Dec 14, 2018
3,176 views
What is the return value of following function for 484? What does it to in general?bool fun(int n){ int sum = 0; for (int odd = 1; n sum; odd = odd+2) sum = ...
1 1 vote
3 3 answers
2.4k
2.4k views
sh!va asked Mar 2, 2017
2,353 views
The library function exit ( ) causes as exit from (a) the loop in which it occurs(b) the block is which it occurs(c) the functions in which it occurs(d) the progam in whi...