Monday 4 July 2016

Write the output (with explanation preferably)

What will be the output of the following program
main()
{
char *s1 = "ABCDE";
char *s2 = "AB";
 while
(*s1 == *s2)
{
   if (* s1 =='\0' || *s2 == '\0')
break;
s1++ ;
  s2++;
}
if
if(*s2 == '\0')
printf("ABC") ;
else
printf("XYZ");
}

No comments:

Post a Comment