Question: Consider the following 3 programs: 1 2 3 / / contents of file foo.c: int a = 5 ; int main ( ) { f

Consider the following 3 programs:
123
//contents of file foo.c: int a =5; int main(){ f(); return 0; }//contents of file bar.c: extern int a; void f(){ printf("%d
", a); }
//contents of file foo.c: int a =5; int main(){ f(); return 0; }//contents of file bar.c: static int a =4; void f(){ printf("%d
", a); }
//contents of file foo.c: int a =5; int main(){ f(); return 0; }//contents of file bar.c: int b; void f(){ printf("%d
", b); }
If the command "gcc foo.c bar.c" is executed, which of the above programs do not result in a linker error
Group of answer choices
2 and 3
3 only
2 only
1,2, and 3
1 only

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 Programming Questions!