strcmp or string::compare?

后端 未结 6 2157
北荒
北荒 2020-12-03 11:28

I want to compare two strings. Is it possible with strcmp? (I tried and it does not seem to work). Is string::compare a solution?

Other tha

6条回答
  •  情深已故
    2020-12-03 12:23

    By your question, "is there a way to compare a string to a char?" do you mean "How do I find out if a particular char is contained in a string?" If so, the the C-library function:

      char *strchr(const char *s, int c);
    

    will do it for you.

    -- pete

提交回复
热议问题