C Programming :: Functions - Discussion
Home > C Programming > Functions > MCQs Questions Discussion
29 / 53
Choose the correct option.
Consider the following program which comprises three source files main.c, fl.c, f2.c? What is the output of the program?
#include <stdio.h>
//test.c
void f1 ();
void f2();
static int a;
static int b;
void main()
{
f1 ();
f2();
printf("f5 = %d f6 = %d ", a, b );
}
//f2.c
int a;
int b;
void f2(){
printf("f3 = %d f4 = %d ", a,b);
}
//f1 .c
extern int a;
extern int b;
void f1 ()
{
b = 6;
a= 5;
printf("f1 = %d f2 = %d ", a,b);
}
Consider the following program which comprises three source files main.c, fl.c, f2.c? What is the output of the program?
#include <stdio.h>
//test.c
void f1 ();
void f2();
static int a;
static int b;
void main()
{
f1 ();
f2();
printf("f5 = %d f6 = %d ", a, b );
}
//f2.c
int a;
int b;
void f2(){
printf("f3 = %d f4 = %d ", a,b);
}
//f1 .c
extern int a;
extern int b;
void f1 ()
{
b = 6;
a= 5;
printf("f1 = %d f2 = %d ", a,b);
}
Afl = 5 f2 = 6 f3 = 5 f4 = 6 f5 = 0 f6 = 0
Bfl = 5 f2 = 6 f3 = 5 f4 = 6 f5 = 5 f6 = 6
Cfl = 0 f2 = 0 f3 = 5 f4 = 6 f5 = 0 f6 = 0
Dfl = 5 f2 = 6 f3 = 0 f4 = 0 f5 = 5 f6 = 6
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
No Discussion on this question yet!