declaration Type

Not that new to programming but need a little bit help regarding decltype .. its introduction and what are its advantages.. please do not copy paste from net .. i already have red all of them... also explain me this piece of code.. i mean only the type of variable and value of each variable at the end of code (line by line)

Note : This is the easiest example i have taken from a book... its not an assignment/homework..

1
2
3
4
5
6
 int a = 3,
 b = 4; 
decltype(a) c = a;
 decltype((b)) d = a; 
++c; 
++d;
int a = 3
means it is making an interger which means whole number E.G 1,2,3,4,5 not 1.4 2.3 3.1 etc.

b = 4;
decltype(a) c = a;
decltype((b)) d = a;
++c;
++d;

Would simply put cause an error since b, c and d are not initilized. But assuming they are working perfectly normal

for decltype you should read or could read;
http://en.wikipedia.org/wiki/Decltype
Assuming they are working perfectly normal..... Then ??

. please complete your answer
Topic archived. No new replies allowed.