Jan
31
2013

Two less known stuffs in c++

1. You can insert a single hyperlink in every function. But remember , only one :)

// consoletest.cpp : main project file.

#include “stdafx.h”

using namespace System;

int main(array ^args)
{
Console::WriteLine(L”Hello World”);
http://rwik.in <--- Look ma , no comment tag !!
return 0;
}

The above compiled perfectly in vc++ 2010 .

2. Usage of ternary operator as lValue

Plenty of time we used ternary operator in following way :

result = ( A > B) ? A : B ; // result is going towards rValue

But reverse is also possible .

if (a == 0)
a = 1;
else
b = 1;

Can be written as (a == 0 ? a : b) = 1;

About the Author:

Leave a comment