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
How is a pointer variable declared?
What is 2 d array in c?
Is c easier than java?
How can I pad a string to a known length?
C program to find all possible outcomes of a dice?
Is fortran still used today?
what do you mean by inline function in C?
Explain the use of bit fieild.
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
Is register a keyword in c?
What is %d used for?
write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.
How to define structures? ·
What is new line escape sequence?
In which header file is the null macro defined?