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


Please Help Members By Posting Answers For Below Questions

write a program in c language to print your bio-data on the screen by using functions.

6247


Are pointers integer?

547


How can I read a binary data file properly?

635


Do you know null pointer?

609


What are loops in c?

549






What is switch in c?

647


Why & is used in scanf in c?

623


Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.

3123


Is c is a high level language?

618


What is a double c?

590


Array is an lvalue or not?

638


What does main () mean in c?

613


What is actual argument?

589


Why doesnt long int work?

611


can we change the default calling convention in c if yes than how.........?

2035