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
a) Pass 1, Pass 2
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What are the types of bitwise operator?
Should I learn c before c++?
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
When the macros gets expanded?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
Multiply an Integer Number by 2 Without Using Multiplication Operator
What are the two forms of #include directive?
What are the preprocessor categories?
What is boolean in c?
What does c value mean?
How can I split up a string into whitespace-separated fields?
What are enums in c?
main() { printf("hello"); fork(); }
What is the use of void pointer and null pointer in c language?
What is a function in c?