Tuesday, November 25, 2008

Try this!

#include

void reverse (const char * const sPtr);

int main()
{
char sentence[200];

printf("Enter a line of text:\n");

gets(sentence);
printf("\nThe line printed backward is:\n");
reverse(sentence);
getchar();
getchar();
return 0;
}

void reverse (const char *const sPtr)
{
if (sPtr[0] =='\0')
{ return; }
else
{reverse (&sPtr[1]);
putchar(sPtr[0]);
}
}


The input is :
!dehsinif sah maxe dim eht ,yaruh

what will be the output?

4 comments:

  1. WOW
    COOL!!!
    where did you get this? :-P

    ReplyDelete
  2. From the powerpoint. It is also included in your text book.

    ReplyDelete
  3. omg!!i don't want to see programming in an english subject please!!

    ReplyDelete
  4. Y O U H A V E T O S E E I T
    A N D R E W , P R O G R A M I N G
    I S G O O D F O R Y O U . . .

    I A M T H E G H O S T O F
    T H E P R O G R A M I N G
    P R I N C I P L E S F U T U R E ,
    A N D I W I L L H A U N T I N G Y O U , F O R Y O U
    R U N N I N G F R O M Y O U R
    F A T E . . .

    H O M . . . ^^v

    ReplyDelete