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 / rakhi
b) Fail 1 Fail 2
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Can we declare a function inside a function in c?
Write a program to reverse a given number in c language?
What is #include cctype?
What are qualifiers and modifiers c?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
How is a pointer variable declared?
What happens if a header file is included twice?
Why isn't it being handled properly?
what is the height of tree if leaf node is at level 3. please explain
What are enumerated types?
Why doesnt that code work?
write a c program in such a way that if we enter the today date the output should be next day's date.
What is the best organizational structure?
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?
write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.