Name for this procedure/routine?

This is a discussion on Name for this procedure/routine? within the C Programming forums, part of the General Programming Boards category; I'm going back through some old code and found a few lines that I understand how it works, but I ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    37

    Name for this procedure/routine?

    I'm going back through some old code and found a few lines that I understand how it works, but I can't for the life of me remember the correct name for it:

    (a == 1) ? cprintf("One") : ((a == 2) ? cprintf("Two.") : printf("Something else"));


    I know its basically an "if, or, else" type of thing but can't think of the name and its driving me crazy.

  2. #2
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    ?: is a ternary operator also called conditional operator.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    37
    Thanks! Thats been driving me insane trying to remember what it was called.

Popular pages Recent additions subscribe to a feed

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