Syntax

C++ Auto Type Deduction Syntax

In C++, auto type deduction: lets the compiler deduce the type — auto total = 0.0;

Quick Answer

Syntax
auto total = 0.0;
C++Syntax

Auto Type Deduction

Code example
auto total = 0.0;

Lets the compiler deduce the type.

Learn More

How to auto type deduction in C++

  1. Open your C++ file or editor.
  2. Copy the example, then replace its sample names and values for your code.

C++ Auto Type Deduction Syntax

Use auto total = 0.0;.

Related Syntax References

Frequently asked questions

What is the C++ syntax for auto type deduction?

Use this pattern: auto total = 0.0;

Can I copy this C++ code example?

Yes. Use Copy code and adapt the example to your program.

Is this C++ syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify