Home > Back-end >  C beginners about function
C beginners about function

Time:09-15

Function is subindex (char * s, char * sub)
The reference in brackets should be how to write?
Attach my code I think there is something wrong with no errors should be a function but can't run
please answer thank you,



# include "iostream"
using namespace std;

Int subindex (char * s, char * sub)
{
Int I=0, j=0, len1=strlen (s), len2=strlen (sub);
While (i{
If (sub [j]==s [I])
{
i++; j++;
}
The else
{
i++; J=0;
}
}

If (I=len1) return 1;
The else return (I - len2);
}
Int main ()
{
Char a [1000], char b [1000];
Gets (a);
Gets (b);
Cout

System (" pause ");
return 0;
}

CodePudding user response:

What is the purpose of this program? What topic is, what is your problem? More clearly trouble

CodePudding user response:

The position of should be a sub in the s (index)
  • Related