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

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

In which header file is the null macro defined?

850


what is bit rate & baud rate? plz give wave forms

1512


Are the outer parentheses in return statements really optional?

570


Explain how to reverse singly link list.

603


can we have joblib in a proc ?

1650






What are the features of c languages?

624


What is selection sort in c?

601


How can you pass an array to a function by value?

597


What is keyword with example?

630


Explain how do you print only part of a string?

646


Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)

600


Explain how do you view the path?

649


What is wild pointer in c with example?

570


What is the best way to store flag values in a program?

576


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]

623