0

I need help with arrays

i'm testing two char arrays whether they are equal or not its not working; https://code.sololearn.com/cle9HgKFDCuQ/?ref=app

6th Oct 2019, 8:08 AM
Muhammad Usman
Muhammad Usman - avatar
3 ответов
+ 2
Besides what ~ swim ~ said you probably meant to assign `equals=1;` instead of comparing with `equals==1;` The loop runs all the way to the 50th character which if either name isn't exactly 50 characters you start to compare garbage values after the null character. You could get the length of both strings using strlen, if they are the same then use the length of the string instead of 50, if not the strings are definitely not equal.
6th Oct 2019, 8:57 AM
jtrh
jtrh - avatar
+ 2
Please move the code link from question title to the Description section. Links just don't work in title or Relevant Tags section 👍 (Edit) Code link moved by moderator to Description. 👍
6th Oct 2019, 9:14 AM
Ipang
+ 1
i'll chek and thank u very much;
6th Oct 2019, 8:54 AM
Muhammad Usman
Muhammad Usman - avatar