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 / rakhi
b) Fail 1 Fail 2
Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Explain the use of #pragma exit?
What are header files in c?
Can a program have two main functions?
Which one would you prefer - a macro or a function?
Why do we write return 0 in c?
Explain what is the difference between null and nul?
How we can insert comments in a c program?
Is it valid to address one element beyond the end of an array?
What is time complexity c?
Why does the call char scanf work?
What is the purpose of void in c?
What is the general form of a C program?
Who developed c language and when?
Is c is a procedural language?
Is it possible to execute code even after the program exits the main() function?