I am writing a program in which several lines are entered, and it is necessary to enter them into the array. The input is normal, but then I have to work with individual characters in the rows of the array. How to compare a single string character with a string character from an array? (I tried str [0] == str [i] [0], but it doesn't work that way)

  • What does "not working" mean? And determine str[0] == str[i][0] what is str - an array or a string. And what is your string? char* ? - Anton Shchyrov
  • Does not work - it means incorrectly compares; I have the first line char s1 [], and the second char s2 [] []; I need to compare the last element of s1 with the first element of the i-th row of the array s2 - Sharab

1 answer 1

I have the first line char s1 [], and the second char s2 [] []; I need to compare the last element s1 with the first element of the i-th row of the array s2

Something like this

 if (s1[strlen(s1) - 1] == s2[i][0])