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
why return type of main is not necessary in linux
Which are low level languages?
Write a program to find factorial of a number using recursive function.
Can you please explain the difference between malloc() and calloc() function?
What is %s and %d in c?
In C, What is the #line used for?
When should we use pointers in a c program?
What is the most efficient way to count the number of bits which are set in an integer?
Explain the binary height balanced tree?
How do I round numbers?
When was c language developed?
What is 2 d array in c?
What is the use of a static variable in c?
Explain c preprocessor?
Are c and c++ the same?