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 we can insert comments in a c program?
What is call by value in c?
What are volatile variables in c?
Is c still relevant?
If null and 0 are equivalent as null pointer constants, which should I use?
Difference between macros and inline functions? Can a function be forced as inline?
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
How can I write a function that takes a format string and a variable number of arguments?
What is zero based addressing?
Why pointers are used in c?
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
Differentiate between the expression “++a” and “a++”?
What does d mean?
Are there namespaces in c?
what are the facialities provided by you after the selection of the student.