How to check if a string is in an array of strings in C?

后端 未结 4 609
北海茫月
北海茫月 2021-01-01 19:06

How to write below code in C? Also: is there any built in function for checking length of an array?

Python Code

x = [\'ab\', \'bc\'          


        
4条回答
  •  隐瞒了意图╮
    2021-01-01 20:03

    There is a function for finding string length. It is strlen from string.h

    And then you could use the strcmp from the same header to compare strings, just as the other answers say.

提交回复
热议问题