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 does the c preprocessor do?
Why c is called a mid level programming language?
diff between exptected result and requirement?
How can variables be characterized?
Write a program to find factorial of a number using recursive function.
What is getch?
Difference between constant pointer and pointer to a constant.
What are data structures in c and how to use them?
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
What are the c keywords?
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
What does it mean when the linker says that _end is undefined?
Why is structure important for a child?
write a program to concatenation the string using switch case?
Whats s or c mean?