-
Junior Member
Modularity using Functions
Determine the output generated by the following code segments, assuming the surrounding program code (whatever it is) compiles correctly.
int F1 (int a, int b);
int F2 (int b, int c);
main()
{
int a = 1, b = 2, c = 3;
c = F1 (a, b);
printf ("main: %d %d %d\n", a, b, c);
b = F2 (a, c);
printf ("main: %d %d %d\n", a, b, c);
}
int F1 (int a, int b)
{
printf ("F1: %d %d\n", a, b);
return a;
}
int F2 (int b, int c)
{
printf ("F2: %d %d\n", b, c);
return c;
}
-
Junior Member
Re: Modularity using Functions
The output for the given code will be like
F1:1 2
main:1 2 1
F2:1 1
main:1 1 1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules