C Programming :: String - Discussion
Home > C Programming > String > MCQs Questions Discussion
9 / 26
What is the output of the following C Program?
#include<stdio.h>
#include<string.h>
void main()
{
while (strcmp("some","some\0"))
printf("Strings are not equal\n");
}
#include<stdio.h>
#include<string.h>
void main()
{
while (strcmp("some","some\0"))
printf("Strings are not equal\n");
}
ANo Output No Error
BString are not equal
CCompilation Error
DNone of these
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
STEP-BY-STEP
In line no. 5, we are comparing the 2 strings- "some" and "some\0". So, the strcmp() function returns 0 as both the strings are equivalent. So, now line no. 5 becomes something like while(0), which is false as 0 is always equal to 0. Hence, the while loop does not gets executed and we get no output on the screen.
Read Full Answer
Report Error
Please Login First Click Here