C/C++ : string:: find_last_of

Objectives :

  • File Name : find_last_of_strrchr1.cpp
    char * pch1;
    pch1=strrchr(charray,'s');
    cout<<"Last occurence of "<< pch1-charray+1;
    // C++ find_last_of function
    found=str1.find_last_of("s");
     
  • Key words :
    • C/strrchr : locates the last occurrence of character in a string.
    • C++/ string:: find_last_of function finds the last occurrence of a character in a string
  • Code: find_last_of_strrchr1.txt
 

Step: 1 Create a source file.

Step: 2 Edit and save Source file

Step: 3 Runtime Views:

Step: