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
List some applications of c programming language?
Explain high-order and low-order bytes.
write a program to copy the string using switch case?
What is difference between stdio h and conio h?
How do I determine whether a character is numeric, alphabetic, and so on?
Are the variables argc and argv are local to main?
What is property type c?
What is the hardest programming language?
What is "Hungarian Notation"?
Discuss the function of conditional operator, size of operator and comma operator with examples.
What does *p++ do? What does it point to?
How to declare a variable?
What is the difference between void main and main in c?
What are all different types of pointers in c?
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers