1

I am trying to learn how to use implicitly typed variables in c++.

Should i be using 'auto' from C++0x? If so how?

Can some one provide me with a simple example or a good tutorial on this?

Thank you.

LoudNPossiblyWrong
  • 3,855
  • 7
  • 33
  • 45

2 Answers2

2

Check out this explanation from Bjarne Stroustrup himself: auto -- deduction of a type from an initializer.

Brian Neal
  • 31,821
  • 7
  • 55
  • 59
1
auto x = f();

The type of x will be whatever f() returns.

sbi
  • 219,715
  • 46
  • 258
  • 445