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


Please Help Members By Posting Answers For Below Questions

Differentiate Source Codes from Object Codes

813


What is the purpose of realloc()?

663


How do I get a null pointer in my programs?

614


What is the difference between int main and void main?

570


Explain what does the function toupper() do?

629






How can I generate floating-point random numbers?

600


Is c dynamically typed?

665


What is pragma c?

607


What type of function is main ()?

581


What does 3 mean in texting?

608


What is .obj file in c?

646


Should I learn data structures in c or python?

576


Explain what standard functions are available to manipulate strings?

609


How are portions of a program disabled in demo versions?

745


How many types of operators are there in c?

611