To tylko jedna z 2 stron tej notatki. Zaloguj się aby zobaczyć ten dokument.
Zobacz
całą notatkę
Strchr char *strchr(const char *s, int c); Scans a string for the first occurence of a given character The null-terminator is considered to be part of the string If c does not occur in s, returns NULL #include #include int main() { char string[20]; char *ptr, c = 'r'; strcpy(string, "This is a string"); ptr = strchr(string, c); if (ptr) printf("The character %c is at position: %d\n", c, ptr-string); else printf("The character was not found\n"); return 0; } /* Result: The character r is at position: 12 */
... zobacz całą notatkę
Komentarze użytkowników (0)