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 / reepal
e) syntex error during compilation
Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What is main () in c language?
What is pass by reference in c?
What is identifier in c?
What is the c value paradox and how is it explained?
What is the difference between volatile and const volatile?
How we can insert comments in a c program?
What is || operator and how does it function in a program?
Can main () be called recursively?
a c code by using memory allocation for add ,multiply of sprase matrixes
Can static variables be declared in a header file?
What is a static function in c?
Explain how can I remove the trailing spaces from a string?
Write a program of prime number using recursion.
Explain what is the difference between the expression '++a' and 'a++'?
What is volatile variable in c?