1)Write a program to read a string and find out a word is present in that string and also print starting index of the word using strstr().
Input:
Str1=" Was this the face that launch'd a thousand ships";
Str2="face";
Output:
String 'face' was found at position 14 in string 'Was this the face that launch'd a thousand ships'.
Answers
Answered by
0
Answer:
str 1 and str 2
Explanation:
string face was found at position 14 in string
Answered by
0
Answer:
14
Explanation:
#include<stdio.h>
#include<string.h>
int main()
{
char str1[100] = "Was this the face that launch'd a thousand ships";
char str2[20] = "face";
int l=0;
l = strlen(strstr(str1,str2));
printf("String Starting Position %d \n",strlen(str1)-l+1);
}
Similar questions
Science,
3 months ago
Biology,
3 months ago
Social Sciences,
6 months ago
Math,
6 months ago
Chemistry,
11 months ago