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
a) Pass 1, Pass 2
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Explain the concept and use of type void.
Write programs for String Reversal & Palindrome check
What is include directive in c?
Why void is used in c?
Why functions are used in c?
What is the scope of global variable in c?
What is file in c language?
What is function prototype in c with example?
What is declaration and definition in c?
What is an endless loop?
explain what is fifo?
write a program in c language to print your bio-data on the screen by using functions.
Explain what is a const pointer?
Who is the founder of c language?
What is difference between main and void main?