Consider the following three ANSI-C programs, P1, P2, and P3.
P1
#include <stdio.h>
int a=5;
int main(){
int a=7;
return(0);
}P2
#include <stdio.h>
int main(){
int a=5;
int a=7;
return(0);
}P3
#include <stdio.h>
int main(){
int a=5;
float a=7;
return(0);
}Which one of the following statements is true?
Tap to open full sizeFigure description
A three-column table showing three ANSI-C programs side by side (P1, P2, P3), each a short program with #include <stdio.h> and a main() (or global + main) declaring a variable named a twice at different or the same scope, as given in the stem's code blocks above.
- (A)
Only P1 will compile without any error
- (B)
Only P2 will compile without any error
- (C)
Only P3 will compile without any error
- (D)
All three programs P1, P2, and P3 will compile without any error