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 / vinay deore
Fail 1,Fail 2
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
Difference between Function to pointer and pointer to function
Explain what are preprocessor directives?
What is a constant?
How can I swap two values without using a temporary?
in linking some of os executables are linking name some of them
What is the use of void pointer and null pointer in c language?
Explain the difference between structs and unions in c?
What is the difference between c and python?
Why is c used in embedded systems?
How does struct work in c?
What are the storage classes in C?
What is use of null pointer in c?
FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2)} a.error b. c. d.
What is derived datatype in c?
Which one would you prefer - a macro or a function?