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
Describe wild pointers in c?
What are loops c?
How do we print only part of a string in c?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
develop algorithms to add polynomials (i) in one variable
Why we use break in c?
Are there namespaces in c?
What happens if header file is included twice?
What is the difference between strcpy() and memcpy() function in c programming?
can any one provide me the notes of data structure for ignou cs-62 paper
What is the purpose of the statement: strcat (S2, S1)?
why wipro wase
When should the volatile modifier be used?
What is a program flowchart and how does it help in writing a program?
What is the use of sizeof () in c?