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 / rakhi
b) Fail 1 Fail 2
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What is a far pointer in c?
What is meant by realloc()?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
When should you use a type cast?
what is the diffrenet bettwen HTTP and internet protocol
a program that can input number of records and can view it again the record
What is the difference between fread and fwrite function?
What are the main characteristics of c language describe the structure of ac program?
Does sprintf put null character?
How many keywords are there in c?
What does do in c?
State two uses of pointers in C?
How many levels deep can include files be nested?
if p is a string contained in a string?
Explain what is the difference between far and near ?