What will be the result of the following program?
main()
{
char p[]="String";
int x=0;
if(p=="String")
{
printf("Pass 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
else
{
printf("Fail 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
}
a) Pass 1, Pass 2
b) Fail 1, Fail 2
c) Pass 1, Fail 2
d) Fail 1, Pass 2
e) syntax error during compilation
Answer Posted / vinay deore
Fail 1,Fail 2
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
What are the valid places to have keyword “break”?
How does struct work in c?
What is include directive in c?
What are the benefits of c language?
Why do we use & in c?
What is graph in c?
When is a null pointer used?
What is getch?
What is bubble sort technique in c?
What are control structures? What are the different types?
How can I implement sets or arrays of bits?
What is the purpose of & in scanf?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
What is structure in c explain with example?
Why is %d used in c?