Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3211096
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:41:17+00:00 2026-05-17T14:41:17+00:00

This classic ioccc entry is a Hello World program written in C. Can anyone

  • 0

This classic ioccc entry is a Hello World program written in C. Can anyone please provide an explanation of how it works?

Original code (syntax highlighting intentionally missing):

int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
o, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}

Slightly cleaner:

int i;
main()
{
  for ( ; i["]<i;++i){--i;}"]; read('-' - '-', i++ + "hello, world!\n", '/' / '/'));
}

read(j, i, p)
{
  write(j / p + p, i-- - j, i / i);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T14:41:17+00:00Added an answer on May 17, 2026 at 2:41 pm

    for loop condition

    i["]<i;++i){--i;}"]
    

    This expression takes advantage of the fact that array indexing is commutative in C. It is equivalent to.

    "]<i;++i){--i;}"[i]
    

    So the loop will terminate when the character at position i is \0, i.e., at the end of the string, which is 14 characters long (which happens to be the same length as “hello, world!\n”). So the for loop condition can be rewritten as:

    i != 14
    

    character arithmetic

    read('-' - '-', i++ + "hello, world!\n", '/' / '/')
    

    char is an integer type, and thus:

    • '-' - '-' is 0
    • '/' / '/' is 1

      read(0, i++ + “hello, world!\n”, 1)


    After fixing all the compiler warnings (like implicit int to pointer conversion), and simplifying the things mentioned above, the code becomes:

    #include <unistd.h>
    
    int i = 0;
    
    void read2(int, char*, int);
    
    int main()
    {
       while (i != 14)
       {
          read2(0, i++ + "hello, world!\n", 1);
       }
    
       return 0;
    }
    
    void read2(int j, char* i, int p)
    {
       write(j / p + p, i-- - j, 1);
    }
    

    (I renamed read to read2 to avoid conflicting with the Unix read function.)

    Note that the j and p arguments to read2 are unneeded, as the function is always called with j=0 and p=1.

    #include <unistd.h>
    
    int i = 0;
    
    void read2(char*);
    
    int main()
    {
       while (i != 14)
       {
          read2(i++ + "hello, world!\n");
       }
    
       return 0;
    }
    
    void read2(char* i)
    {
       write(1, i--, 1);
    }
    

    The call write(1, i--, 1) writes 1 character from i to file descriptor 1 (stdout). And the postdecrement is superfluous because this i is a local variable never referenced again. So this function is equivalent to putchar(*i).

    Inlining the read2 function within the main loop gives

    #include <stdio.h>
    
    int i = 0;
    
    int main()
    {
       while (i != 14)
       {
          putchar(*(i++ + "hello, world!\n"));
       }
    
       return 0;
    }
    

    for which the meaning is obvious.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't find any documentation regarding this line of ASP classic code; Set objTemplate
I've gone rounds with this ever since I started programming classic ASP 12 (or
I currently have a project converting asp classic codes to C#, then i came
this is kind of tricky: I have an C# web application running always on
This is homework...I'm not asking for answers, I just have a bug I'm not
While it seems that this has been asked many times before, but there's a
I have think this question few month for my .NET project (winform & webform)
So I am using Subversion as SCM for a classic ASP webapp that I
I read different responses to the question of detecting stack growth detection and I
Is there a way of limiting the number of asp.net (in-process) sessions from within

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.