In order to search for a particular character in a C++ string, use the following code.

#include <iostream>
#include <cstring>

using namespace std;

int main() {

  const char *testStr= "coderz@heaven";

  const char *temp;

  // Searching
  temp = strchr(testStr, '@');

  if(temp )

      cout << "Found";

  return 0;

Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.