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
How can a number be converted to a string?
Write a factorial program using C.
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.
What is a buffer in c?
What are the 4 types of unions?
What do you mean by Recursion Function?
what is the role you expect in software industry?
There seem to be a few missing operators ..
What does dm mean sexually?
What is the main difference between calloc () and malloc ()?
What is difference between %d and %i in c?
What is the description for syntax errors?
What are the properties of union in c?
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
What are control structures? What are the different types?