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

What is main () in c language?

830


What is pass by reference in c?

848


What is identifier in c?

753


What is the c value paradox and how is it explained?

781


What is the difference between volatile and const volatile?

743


How we can insert comments in a c program?

843


What is || operator and how does it function in a program?

835


Can main () be called recursively?

864


a c code by using memory allocation for add ,multiply of sprase matrixes

2517


Can static variables be declared in a header file?

807


What is a static function in c?

823


Explain how can I remove the trailing spaces from a string?

798


Write a program of prime number using recursion.

813


Explain what is the difference between the expression '++a' and 'a++'?

862


What is volatile variable in c?

850