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

Give basis knowledge of web designing ...

1671


When should the register modifier be used? Does it really help?

699


why return type of main is not necessary in linux

1789


Whats s or c mean?

685


Are global variables static in c?

762






what are non standard function in c

1534


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2526


What are the different file extensions involved when programming in C?

872


Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10

15252


Can we increase size of array in c?

623


What are the back slash character constants or escape sequence charactersavailable in c?

791


What are the types of variables in c?

667


What is echo in c programming?

646


What is console in c language?

714


Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc

5188