What happens if you try to compile and run this program?
What happens if you try to compile and run this program?
#include <stdio.h>
int main (int argc, char *argv[]) {
char *p = "John" " " "Bean";
printf("[%s]", p) ;
return 0;
}
Choose the right answer:
A . The program outputs "[]"
B . The program outputs nothing
C . The program outputs [John Bean]
D . The program outputs three lines of text
E . The program outputs two lines of text
Answer: C
Explanation:
The string literal "John" " " "Bean" is effectively concatenated into a single string by the compiler during compilation. Therefore, the value of p becomes a pointer to the string "John Bean". The printf statement then prints the string enclosed within square brackets, resulting in the output [John Bean].
Latest CLA-11-03 Dumps Valid Version with 40 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund