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
Is register a keyword in c?
The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...
Write program to remove duplicate in an array?
What is a dynamic array in c?
What is oops c?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
How can I convert a number to a string?
What is extern storage class in c?
What type is sizeof?
What is the meaning of && in c?
Why is event driven programming or procedural programming, better within specific scenario?
How do you construct an increment statement or decrement statement in C?
Write a program to print factorial of given number without using recursion?
What are type modifiers in c?