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 / reepal

e) syntex error during compilation

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

why return type of main is not necessary in linux

1789


Which are low level languages?

729


Write a program to find factorial of a number using recursive function.

740


Can you please explain the difference between malloc() and calloc() function?

720


What is %s and %d in c?

672






In C, What is the #line used for?

1267


When should we use pointers in a c program?

740


What is the most efficient way to count the number of bits which are set in an integer?

674


Explain the binary height balanced tree?

807


How do I round numbers?

690


When was c language developed?

798


What is 2 d array in c?

653


What is the use of a static variable in c?

682


Explain c preprocessor?

769


Are c and c++ the same?

707