Swap occurrences of two most frequent letters in a string

后端 未结 2 1180
情深已故
情深已故 2021-01-26 12:00

I don\'t know what is the problem in my code, but when I compile I get:

warning: passing arg 2 of `strcspn\' makes pointer from integer without a cast

2条回答
  •  清歌不尽
    2021-01-26 12:15

    strcspn(const char *str1, const char *str2) looks for the first instance of any characters in the second string in the first string. You are passing a character instead of a string as the second argument. You want the function strchr(const char *string, int character), which looks for a single character.

提交回复
热议问题