新手求助!指针的指针的题出现的问题
#include <stdlib.h>#include <stdio.h>#include <string.h>int main ( void ) { void sort_string ( char **q ) ; char *p[5] = { "China" , "America" , "India" , "Philippines" , "Canada" } ; char **q = p ; sort_string ( q ) ; for ( q = p ; q - p < 5 ; q ++ ) { puts ( *q ) ; } printf ( "\n" ) ; system ( "pause" ) ; return EXIT_SUCCESS ;}void sort_string ( char **q ) { int i , j ; char temp[80] ; for ( j = 0 ; j < 4 ; j ++ ) for ( i = 0 ; i < 4 - j ; i ++ ) { if ( strcmp ( *( q + i ) , *( q + i + 1 ) ) > 0 ) { strcpy ( temp , *( q + i ) ) ; strcpy ( *( q + i ) , * ( q + i + 1 ) ) ; strcpy ( * ( q + i + 1 ) , temp ) ; } }}
#include <stdlib.h>#include <stdio.h>#include <string.h>int main ( void ) { void sort_string ( char **q ) ; char *p[5] = { "China" , "America" , "India" , "Philippines" , "Canada" } ; char **q = p ; sort_string ( q ) ; for ( q = p ; q - p < 5 ; q ++ ) { puts ( *q ) ; } printf ( "\n" ) ; system ( "pause" ) ; return EXIT_SUCCESS ;}void sort_string ( char **q ) { int i , j ; char *temp ; for ( j = 0 ; j < 4 ; j ++ ) for ( i = 0 ; i < 4 - j ; i ++ ) { if ( strcmp ( *( q + i ) , *( q + i + 1 ) ) > 0 ) { temp=*( q + i ) ; *( q + i )= *( q + i + 1 ) ; *( q + i + 1 )=temp; } }}