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
a) Pass 1, Pass 2
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is pointer to pointer in c?
What's a good way to check for "close enough" floating-point equality?
What is dangling pointer in c?
What are lookup tables in c?
Can math operations be performed on a void pointer?
What are multibyte characters?
How many types of arrays are there in c?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
Write a Program to find whether the given number or string is palindrome.
What does struct node * mean?
Is it possible to initialize a variable at the time it was declared?
What are the different types of C instructions?
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
Can two or more operators such as and be combined in a single line of program code?