output of the program??

#include<conio.h>
#include<stdio.h>
#include<string.h>
void fun(char str1[],char str2[])
{ if(NULL!=(strcmp(str1,str2)))
printf("STrings are not equal\n");
else
printf("B");

}
main(void) {
char str1[]={'a','b','c','d'};
char str2[]={'a','b','c','d'};
clrscr();
fun(str1,str2);
}

compiler says Strings are not equal...but y?
The strings are not null terminated. Change to
char str1[] = {'a','b','c','d','\0'};
or
char str1[] = "abcd";
Both do exactly the same.
Topic archived. No new replies allowed.