0 votes 0 votes #include<stdio.h> int main() { char s1[10]="ABC"; char s2[10]="ABC"; if(s1==s2) printf("Equal"); else printf("Not equal"); } Here output is $\text{Not equal}$ please explain the output Programming in C programming-in-c + – kd..... asked Apr 28, 2018 • retagged Apr 29, 2018 by Subarna Das kd..... 473 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 1 votes 1 votes ............. abhishekmehta4u answered Apr 28, 2018 • selected Apr 28, 2018 by Arjun abhishekmehta4u comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes Using s1 and s2, you are comparing pointers, i.e., starting address of both strings, which obviously isn't same. To compare two strings use strcmp: https://www.geeksforgeeks.org/strcmp-in-c-cpp/ Akhilesh Singla answered Apr 28, 2018 Akhilesh Singla comment Share Follow See all 0 reply Please log in or register to add a comment.