You are not logged in. Please login at to post your questions!


What is strstr(s1,s2) in c++ ?

What is strstr(s1,s2) in c++ ?

Can anyone explain withthe help of an answer

asked 06 Dec '17, 16:44

pandey_96's gravatar image

accept rate: 0%

I think this type of question can be easily googled. Did you try that?

(06 Dec '17, 20:02) vijju123 ♦4★

Refer Here
This function takes two strings s1 and s2 as an argument and finds the first occurrence of the sub-string s2 in the string s1. The process of matching does not include the terminating null-characters(‘\0’), but function stops there.


answered 06 Dec '17, 17:12

kailashnath199's gravatar image

accept rate: 23%

edited 06 Dec '17, 17:12

The concept is very simple Firstly it is a pre-f=defined function in C++

strstr(s1,s2); //This simply means that this function returns a "pointer" to the first occurence of string s2 in that string.

Hope this statement made it clear for you. Happy coding !


answered 08 Dec '17, 15:33

saiff_ansari's gravatar image

accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 06 Dec '17, 16:44

question was seen: 246 times

last updated: 08 Dec '17, 15:33