Created
July 6, 2021 04:24
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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