在char数组中搜索子字符串

use*_*716 7 c++

据我所知,C++字符串中有一个函数执行子字符串搜索:string1.find(string2).

有没有办法在char中执行相同的操作?以下是我的问题:

    #include <iostream>
    #include <cstring>
    using namespace std;
    int main()
    { 
      char a[]="hello world!";
      char b[]="el";
      //find substring b[] in a[]


    }
Run Code Online (Sandbox Code Playgroud)

假设我需要在字符串中找到子串"el",是否可以这样做?

Eli*_*hne 14

char *output = NULL;
output = strstr (a,b);
if(output) {
    printf("String Found");
}
Run Code Online (Sandbox Code Playgroud)