Question: Below are the C and Java codes for the same programme. Compare the results of both with the reasons. #include #include int x = 5

Below are the C and Java codes for the same programme. Compare the results of both with the reasons.
#include
#include
int x =5;
int test (int y)
{
x = y;
return 6;
}
int main()
{
x = x + test (3);
printf("%d",x);
return 0;
}
import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
public static int x =5;
public static int test(int y)
{
x = y;
return 6;
}
public static void main(String[] args) throws java.lang.Exception
{
x = x + test (3);
System.out.println(x);
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!