Wipro
Company
Programming
Database
One c program is written in 2 files
/*Program1.c*/
int x=10
/*Program2.c*/
#include "Program1.c"
int main()
{
extern int x;
printf("x : %d",x);
}
In Program2.c statement extern int x; is not needed.
A. True
B. False
Read Solution (Total 11)
-
- A. True
Bcozzz in program1.c, x is not declared inside main() ... So its a global variable... It can be accessed by another file directly by including the filename in that file (ie should include "program1.c" in program2.c"]
This is more than enough to access the global variable of another file...
So extern int x is not needed... - 10 years agoHelpfull: Yes(41) No(2)
- False
Since extern Keyword is used to link the variable to its value given outside the scope.Since x is defined and declared in another program so it is necessary - 10 years agoHelpfull: Yes(7) No(3)
- false,as extern keyword links the variable defined in two separate programs,otherwise it will treated as global variable in program1.c only.
- 10 years agoHelpfull: Yes(2) No(0)
- FALSE ....extern keyword is required because x is declared in another program
- 10 years agoHelpfull: Yes(1) No(0)
- A.TRUE
BECAUSE X IS A GLOBAL VARIABLE - 10 years agoHelpfull: Yes(1) No(1)
- A) because variable is having global scope default
- 9 years agoHelpfull: Yes(1) No(1)
- not need because x is already globally initiated
- 10 years agoHelpfull: Yes(0) No(1)
- true.becoz it is already included
- 10 years agoHelpfull: Yes(0) No(1)
- Yes It Is needed as We Included The prev PRog omn Prog2.c And extern is reqd to acess The vars from other files.............
- 10 years agoHelpfull: Yes(0) No(0)
- A. True
In program 2.c .... extern int x; is not needed. x value will be 10 when it prints even if we not declare in 2.c, but we have to include file name of the program where we have declared and initialized the x. - 7 years agoHelpfull: Yes(0) No(0)
- the answer is false because extren is needed for accessing from the other files.
- 5 years agoHelpfull: Yes(0) No(0)
Wipro Other Question