Fun with C

This is a very old code written by me back in 2000 to make my sister happy. I found this code in my old hard disk a couple of weeks back. Try this.

#include <stdio .h>
int main(int argc, char* argv[])
{
    char* aString = "I am a monkey. ";
    int index = 0;
    char aChar;
    printf("Type something here. \n\n");
    do
    {
        aChar = getch();
        if (';' != aChar)
        {
            printf("%c", aString[index++]);
            index = (index >= 15) ? 0 : index;
        }
    }
    while (';' != aChar);
    printf("\n\nWow! thats cool. \nPress ENTER to exit.");
    getchar();
    return 0;
}

Advertisements