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
Fail 1,Fail 2
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
Why can’t we compare structures?
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
What is signed and unsigned?
In a switch statement, what will happen if a break statement is omitted?
Write a code of a general series where the next element is the sum of last k terms.
What is line in c preprocessor?
can we implement multi-threads in c.
What are the uses of null pointers?
Is c call by value?
What is a pointer variable in c language?
Does c have class?
How can I automatically locate a programs configuration files in the same directory as the executable?
Why is main function so important?
Why c language is called c?
Explain how are 16- and 32-bit numbers stored?