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
What is the difference between c and python?
Does c have class?
Why c is faster than c++?
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }
Simplify the program segment if X = B then C ← true else C ← false
Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014 Npu university
Is c high or low level?
A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM
Explain argument and its types.
Why isn't any of this standardized in c? Any real program has to do some of these things.
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
How can I prevent another program from modifying part of a file that I am modifying?
What is sizeof in c?
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...
How can my program discover the complete pathname to the executable from which it was invoked?