#include <stdio.h>
#include <string.h>
int main(void)
{
const char *str = "Try not. Do, or do not. There is no try.";
char target = 'T';
const char *result = str;
while((result = strchr(result, target)) != NULL) {
printf("Found '%c' starting at '%s'\n", target, result);
++result; // Increment result, otherwise we'll find target at the same location
}
}
Reference:2015年4月28日 星期二
訂閱:
張貼留言 (Atom)
0 意見:
張貼留言