1. 程式人生 > >C 指向指標的指標

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);
    
}