35 35 votes Consider the following C program : #include<stdio.h> int jumble(int x, int y){ x = 2*x+y; return x; } int main(){ int x=2, y=5; y=jumble(y,x); x=jumble(y,x); printf("%d \n",x); return 0; } The value printed by the program is ______________. Programming in C gatecse-2019 programming-in-c numerical-answers identify-function one-mark + – Arjun 16.7k views answer comment Share Follow Print See all 2 Comments 2 2 Comments reply Dharmendra Lodhi commented Feb 7, 2019 reply Follow flag 26 11 11 replyShare Khushraj_Singh commented Aug 28 reply Follow flag This question Littile try to Trick you 0 0 replyShare Please log in or register to add a comment.
Best answer 51 51 votes $x = 2, y = 5$ $y =$ jumble$(5,2)$ //call by value and $y$ will hold return value. After this call $x = 2, \: y = 12$ $x =$ jumble$(12, 2)$ //call by value and $x$ will hold return value. After this call $x = 26, \: y = 12$ $x=26$ Digvijay Pandey answered Feb 7, 2019 • edited Apr 29, 2019 by go_editor Digvijay Pandey comment Share Follow See all 6 Comments 6 6 Comments reply Show 3 previous comments Ram Swaroop commented Jan 29, 2020 reply Follow flag if return statement not given then value of x y not changed it works just simple call by value 1 1 replyShare GravitonQR commented Jan 19 reply Follow flag @Ram Swaroop If we remove return statement from jumble(), still output is coming to be 26. 0 0 replyShare Gate 11 commented May 23 reply Follow flag @GravitonQR This is true only in call by reference. In C, function arguments are passed using call by value, so the return statement is needed to update the variables in main(). Without the return statement, the changes made to x inside jumble() will not affect the variables in main(). 1 1 replyShare Please log in or register to add a comment.
3 3 votes jumble function is just taking 2 arguments say arg1 and arg2. and returning (2*arg1) + arg2 in main function we have below: y=jumble(5,2);---main called jumble function with arguments 5,2 initially and result was stored in variable y here y becomes 12 i.e: (2*10)+2 x remains same which is 2 x=jumble(12, 2);----main again called jumble function with arguments 12,2 and stored in variable x so x becomes 26 i.e: (2*12)+2 finally x will be printed output: 26 sandeeps answered Feb 13, 2019 sandeeps comment Share Follow 0 reply Please log in or register to add a comment.
1 1 vote 1st jumble will return 12 that will be stored in y. this y will be passed as parameter in 2nd jumble that will return 26 in x. manikantsharma answered Jul 19, 2019 manikantsharma comment Share Follow 0 reply Please log in or register to add a comment.
1 1 vote y=jumble(5,2) will return 12 and x=jumble(12,2) will return 26 so pf(x)-->26 Answer---26 Arnabh Gangwar answered Oct 3, 2019 Arnabh Gangwar comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes Following is the solution to this question: amaanshaikh_27 answered Aug 17 amaanshaikh_27 comment Share Follow 0 reply Please log in or register to add a comment.