diff options
Diffstat (limited to '2.3-1/src/c/string/strcspn/gstrcspna.c')
-rw-r--r-- | 2.3-1/src/c/string/strcspn/gstrcspna.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/2.3-1/src/c/string/strcspn/gstrcspna.c b/2.3-1/src/c/string/strcspn/gstrcspna.c index 4dcdcdf6..2c83c724 100644 --- a/2.3-1/src/c/string/strcspn/gstrcspna.c +++ b/2.3-1/src/c/string/strcspn/gstrcspna.c @@ -14,13 +14,13 @@ #include "strcspn.h" uint8 gstrcspna(char *str1,int size1,char *str2,int size2) { - int ind,i,j;; - - for(i=0;i<=size1;i++) + int ind,i,j; + + for(i=0;i<=size2;i++) { - for(j=0;j<=size2;j++) + for(j=0;j<=size1;j++) { - if(str2[j]==str1[i]) + if(str2[i]==str1[j]) { ind=j; break; @@ -29,22 +29,4 @@ uint8 gstrcspna(char *str1,int size1,char *str2,int size2) } return (ind+1); } -/*int main() -{ - int n1,n2; - char inp1[100000],inp2[100000]; - printf("Enter the length of the first string"); - scanf("%d",&n1); - for(int i=0;i<=(n1+1);i++) - { - scanf("%c",&inp1[i]); - } - printf("Enter the length of the second string"); - scanf("%d",&n2 ); - for(int j=0;j<=(n2+1);j++) - { - scanf("%c",&inp2[j]); - } - strcspnfn(inp1,n1+1,inp2,n2+1); -} -*/ + |