Puoi farlo in innumerevoli linguaggi di programmazione ed in innumerevoli modi.
Eccotene uno in PHP 5.2.9
che in output produce:Codice PHP:<?php
function EchoReverseStringRecursive (&$theString, $theLength){
assert ('true == isset ($theString)');
assert ('true == isset ($theLength)');
if ($theLength > 0){
echo $theString [$theLength - 1];
EchoReverseStringRecursive ($theString, $theLength - 1);
}
}
function main (){
$aString = "Hello World!";
EchoReverseStringRecursive ($aString, strlen ($aString));
echo "\n";
}
main ();
?>
;-)codice:$ php -f main.php !dlroW olleH

Rispondi quotando