code vault - string_posWhat links here?

Code

//##############################################################################
// Return the position of sub in string.
// Return the length of string if sub not found.
//##############################################################################


int pos(char *sub, char *string) { int i, j;

for(i = 0; i < strlen(string); i++) { for (j = 0; j < strlen(sub); j++) { if (string[i+j] != sub[j]) break; } if (j == strlen(sub)) return(i); } return(strlen(string)); }

Alternate version

//##############################################################################
// Return the position of sub in string.
// Return the -1 if sub not found.
//##############################################################################


int pos(char *sub, char *string) { int i, j;

for(i = 0; i < strlen(string); i++) { for (j = 0; j < strlen(sub); j++) { if (string[i+j] != sub[j]) break; } if (j == strlen(sub)) return(i); } return(-1); }
code vault - string_pos
programming - SWEET16
programming:forth
programming:windows:windows destruction
file formats - PDF - rectangle
file formats - PDF - name objects
filename:code vault - string_pos
filename:code%20vault%20%2D%20string_pos
last edit:March 26 2009 19:52:24 (5930 days ago)
ct = 1750535402.000000 = June 21 2025 15:50:02
ft = 1238111544.000000 = March 26 2009 19:52:24
dt = 512423858.000000