From 4dd56b93e9b7b44b5725ed8ffd523272245be9af Mon Sep 17 00:00:00 2001 From: Prem Kagrani Date: Sun, 14 Oct 2018 21:45:55 +0530 Subject: [PATCH] Important point about auto added! (#18489) --- .../src/pages/guide/english/cplusplus/the-auto-feature/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/pages/guide/english/cplusplus/the-auto-feature/index.md b/client/src/pages/guide/english/cplusplus/the-auto-feature/index.md index f577b4a949..44bc904ace 100644 --- a/client/src/pages/guide/english/cplusplus/the-auto-feature/index.md +++ b/client/src/pages/guide/english/cplusplus/the-auto-feature/index.md @@ -31,6 +31,7 @@ auto last_employee = employees.back(); ``` Once the compiler determines the type on the right side of the `=` it replaces `auto` with that type. +However,it should be noted that it is mandatory to intialize the variable marked as auto while declaring so that the compiler can know the type of that variable. In modern versions of C++ (since C++14), `auto` can also be used in a function declaration as the return type. The compiler will then infer the return type from the return statement inside of the function. Following the example with employees: