View Single Post
Old 10-15-2004, 10:54 AM   #1 (permalink)
LauraP
 
Newb Techie

Join Date: Oct 2004

Posts: 14

LauraP

Default Help with JAVA coding

...If you have a function as follows:
int fun(int *k)
{
*k +=4;
return 3*(*k)-1;
}
...and if fun is used in the program below:
void main()
{
int i = 10;
int j = 10;
int sum1;
int sum2;

sum1 = (i/2)+ fun(&i);
sum2 = fun(&j) + (j/2);
}
...what is the values of sum1 and sum2 if the operands in the expressions are
looked at from left to right and right to left?

Could someone please help me with this question? I would highly appreciate it

Thanks!
LauraP is offline