View Single Post
  #5  
Old 05-17-2013, 10:00 PM
GODPARTICLE GODPARTICLE is offline
Banned


Join Date: Apr 2013
Posts: 85
Default

Quote:
Originally Posted by GODPARTICLE [You must be logged in to view images. Log in or Register.]
btw what is that Rogean perl or something? What's the world coming to with ternary operations in a string format. Wonder if that's valid in C/C++
I thought it would be, my assumption is correct

Code:
#include <stdio.h>

int main()
{
    const int b = 1;
    printf("%s %s", b ? "cando" : "nutdo", !b ? "cando" : "nutdo");

    return 0;
}
output

Code:
cando nutdo
compiles with both c and c++
Last edited by GODPARTICLE; 05-17-2013 at 10:03 PM..