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
what is use of malloc and calloc?
Explain how can I pad a string to a known length?
What type of function is main ()?
What are loops in c?
How many levels of pointers can you have?
How to throw some light on the b tree?
What are keywords in c with examples?
What is the use of define in c?
c program to compute AREA under integral
What is the use of structure padding in c?
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
What is a const pointer?
What is hash table in c?
What is structure in c definition?
What is the use of parallelize in spark?