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
What will be the outcome of the following conditional statement if the value of variable s is 10?
Explain two-dimensional array.
How do you generate random numbers in C?
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.
Why is structure important for a child?
What is volatile variable in c?
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
What are the differences between Structures and Arrays?
What is the advantage of c?
Explain what is meant by 'bit masking'?
What’s a signal? Explain what do I use signals for?
How to compare array with pointer in c?
a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if
What are the rules for identifiers in c?
Write a progarm to find the length of string using switch case?