Skip to content

Instantly share code, notes, and snippets.

@alsamitech
Created July 6, 2021 04:24
Show Gist options
  • Select an option

  • Save alsamitech/6142d740bd22ef44262566940f7c161c to your computer and use it in GitHub Desktop.

Select an option

Save alsamitech/6142d740bd22ef44262566940f7c161c to your computer and use it in GitHub Desktop.
char_instance - returns the position of a specified instance of ch in a Cstring
char* char_instance(char* src, char ch,size_t instance){
for(size_t c=0;*src&&c<instance;src++)
if(*src==ch)c++;
return src;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment