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

c)Pass 1, Fail 2

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Describe wild pointers in c?

636


What are loops c?

614


How do we print only part of a string in c?

579


Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

669


develop algorithms to add polynomials (i) in one variable

1734






Why we use break in c?

544


Are there namespaces in c?

564


What happens if header file is included twice?

650


What is the difference between strcpy() and memcpy() function in c programming?

624


can any one provide me the notes of data structure for ignou cs-62 paper

1698


What is the purpose of the statement: strcat (S2, S1)?

638


why wipro wase

1823


When should the volatile modifier be used?

677


What is a program flowchart and how does it help in writing a program?

655


What is the use of sizeof () in c?

553