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 / guest
d) Fail 1, Pass 2
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Differentiate Source Codes from Object Codes
What is the purpose of realloc()?
How do I get a null pointer in my programs?
What is the difference between int main and void main?
Explain what does the function toupper() do?
How can I generate floating-point random numbers?
Is c dynamically typed?
What is pragma c?
What type of function is main ()?
What does 3 mean in texting?
What is .obj file in c?
Should I learn data structures in c or python?
Explain what standard functions are available to manipulate strings?
How are portions of a program disabled in demo versions?
How many types of operators are there in c?