C Programming - Functions - Discussion
Discussion Forum : Functions - Find Output of Program (Q.No. 12)
12.
What will be the output of the program?
#include<stdio.h>
int addmult(int ii, int jj)
{
int kk, ll;
kk = ii + jj;
ll = ii * jj;
return (kk, ll);
}
int main()
{
int i=3, j=4, k, l;
k = addmult(i, j);
l = addmult(i, j);
printf("%d %d\n", k, l);
return 0;
}
Discussion:
91 comments Page 8 of 10.
Hari said:
1 decade ago
In above programme last return which value taken that value prints two times
Subham said:
8 years ago
In return(kk,LL).
The value of LL will be return only commo operation rule.
The value of LL will be return only commo operation rule.
Ajay debata said:
1 decade ago
return 1,2,3;
here the right most value is returned.
so 3 will be returned.
here the right most value is returned.
so 3 will be returned.
Sachin vishvkrma said:
1 decade ago
Coma (,) operater has right to left associativity, not to left to right.
Dhiraj said:
7 years ago
The prototype is not defined how will program work is it possible?
Nilesh said:
9 years ago
In return statement can we return two values at a time?
Jains said:
1 decade ago
Very nice explanation! sundar.
Have a nice day.
Have a nice day.
Harish said:
1 decade ago
Only return (kk) is being executed each time.
TDas said:
5 years ago
How it Returns two value at the same time?
Abhi said:
1 decade ago
@Ravindra.
A sufficient one Ravindra :-).
A sufficient one Ravindra :-).
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers