Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #define MAX 80
- int ondeEsta(char frase1[], char frase2[])
- {
- int i,j,count=0,n=0;
- for(i=0;i<strlen(frase1);i++)
- { if(frase1[i]==frase2[0]){
- for(j=0;j<strlen(frase2);j++)
- {
- if(frase1[i] == frase2[j])
- {
- count++;
- if(strlen(frase2) == count)
- {
- return i-count;
- }
- i++;
- n++;
- }
- else count =0;i=i-n+1;break;
- }}
- }
- return -1;
- }
- int main(void)
- {
- char frase1[MAX],frase2[MAX];
- gets(frase1);
- gets(frase2);
- printf("%d\n",ondeEsta(frase1,frase2));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement