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

please can any one suggest me best useful video tutorials on c i am science graduate.please help me.u can email me to sas29@in.com

1327


Write a simple code fragment that will check if a number is positive or negative.

708


How would you use the functions fseek(), freed(), fwrite() and ftell()?

702


What are structural members?

568


Does c have enums?

600






How to write a multi-statement macro?

621


Can you add pointers together? Why would you?

644


Can a pointer point to null?

586


What is time null in c?

581


What is LINKED LIST? How can you access the last element in a linked list?

633


What is the difference between break and continue?

604


Is fortran still used in 2018?

595


Why static is used in c?

620


Explain c preprocessor?

683


What are static variables in c?

628