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
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.
+ 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. 👍
+ 1
i'll chek and thank u very much;