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
Explain what is output redirection?
What is a MAC Address?
If errno contains a nonzero number, is there an error?
Why is c called "mother" language?
What is function what are the types of function?
Can a local variable be volatile in c?
What are different types of pointers?
What are the 5 types of inheritance in c ++?
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
Why doesnt this code work?
Why c is called a middle level language?
What are valid signatures for the Main function?
What are compound statements?
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
diff between exptected result and requirement?