What does -> do?

This is a discussion on What does -> do? within the C Programming forums, part of the General Programming Boards category; I am learning how to program in C, and I'm wondering what some things do in my tutorial program. Code: ...

  1. #1
    Registered User
    Join Date
    Aug 2013
    Posts
    2

    What does -> do?

    I am learning how to program in C, and I'm wondering what some things do in my tutorial program.

    Code:
    printf("%c -> ", i);
    What does this do?
    Here it is in context.
    Code:
    int main()
    {
        int u = 65;
        int l = 97;
        
        for(int i = l; i < (l + 26); i++)
        {
            printf("%c -> ", i);
            for (int j = u; j < (u + 26); j++)
            {
                if (j == (u + 25))
                {
                    printf("%c", j);
                }
                else
                {
                    printf("%c,", j);
                }
            }
            
            printf("\n");
        }
        return 0;
    }
    Thank you.

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    So have you compiled and run this example?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    In this context, it's just two characters that are printed as-is to the screen in the first printf statement. They don't do anything special; most characters passed to printf are just printed directly.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  4. #4
    Registered User
    Join Date
    Aug 2013
    Posts
    2
    Thank you. I'm surprised I missed that when I ran the program.

Popular pages Recent additions subscribe to a feed

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21