La soluzione può essere notevolmente semplificata secondo me... Ad esempio:
codice:
#include <stdio.h>
#include <string.h>
void printRevStr (char *s)
{
char c;
if (*s == '\0')
return;
else
{
c = *s;
printRevStr (s + 1);
printf ("%c", c);
}
}
int main (void)
{
char s [50];
printf ("\nInserire stringa: ");
scanf ("%s", s);
printf ("\n\nStringa stampata all'incontrario: ");
printRevStr (s);
printf ("\n\n\n");
return 0;
}
Se proprio vuoi usare anche <string.h>, potresti cambiare la procedura così:
codice:
void printRevStr (char *s)
{
char c;
if (strlen(s) == 1)
printf ("%c", *s);
else
{
c = *s;
printRevStr (s + 1);
printf ("%c", c);
}
}