C 指向指针的指针

这里留个例子查找字符串位置

int find_char1( char **strings , char value)
{
    while( *strings != NULL ){
        while( **strings != '\0' ){
            char tmp = *(*strings)++;
            NSLog(@"tmp = %c",tmp);
            if( tmp == value )
            {
                NSLog(@"%c , %c",value ,tmp);
               return TRUE;
            }
            
        }
        strings++;
    }
    return 0;
    
}

- (void)ctest
{
    
    char *string = "I Love China!";
    char **t = &string;
    *(t + 1 )= NULL;
    
    int pos = find_char1(t, '!');
    printf("%s\n", string);
    
}


猜你喜欢

转载自blog.csdn.net/qqMCY/article/details/51648544