String output in reverse order, check the rigor of the program

int reprintfstr ( char *ch, int n)

{

if (NULL == ch || n < 1)

{

printf("The parameter passing is wrong!/n");

return 1;

}

char *pch;

pch = ch + n;

if(NULL == pch)

{

printf("n value is too big!/n");

return 1;

}

 

int i;

i = 0;

for (i = 0; i < n; i++ )

{

printf("%c", pch-i);

}

 

return 0

}

Guess you like

Origin blog.csdn.net/jifeijixufly/article/details/4370790