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
Explain null pointer.
Who developed c language and when?
Why is c called a mid-level programming language?
What is the function of multilevel pointer in c?
How can I change the size of the dynamically allocated array?
What is memcpy() function?
What is difference between arrays and pointers?
Is linux written in c?
What are inbuilt functions in c?
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
What does main () mean in c?
When would you use a pointer to a function?
Can we assign integer value to char in c?
How can I make sure that my program is the only one accessing a file?
What are the salient features of c languages?