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
c)Pass 1, Fail 2
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
What is the difference between scanf and fscanf?
Write a program to find the biggest number of three numbers in c?
Differentiate between full, complete & perfect binary trees.
List some of the dynamic data structures in C?
What is the explanation for cyclic nature of data types in c?
How can I use a preprocessorif expression to ?
Is it better to use malloc() or calloc()?
What is #define?
What is static memory allocation? Explain
what is stack , heap ,code segment,and data segment
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
What are header files and explain what are its uses in c programming?
Can you please compare array with pointer?
What does a pointer variable always consist of?
How do shell structures work?