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
c)Pass 1, Fail 2
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Is printf a keyword?
Why is it that not all header files are declared in every C program?
How pointer is different from array?
What is array within structure?
What is a substring in c?
what is the difference between class and unio?
How can I manipulate individual bits?
What are the 5 data types?
Is it valid to address one element beyond the end of an array?
What is the default value of local and global variables in c?
Can a function argument have default value?
What are the preprocessor categories?
What are identifiers in c?
Differentiate between new and malloc(), delete and free() ?
What is the difference between array and linked list in c?