Using auto with Functions for use type deduction for function parameters and for return types. - C++ Data Type

C++ examples for Data Type:auto

Introduction

Deducing a Function's Return Type Using auto

Demo Code

#include <iostream>

using namespace std;

auto AutoFunctionFromReturn(int parameter)
{
    return parameter;
}

int main()/*from  w w w  .  java 2  s . co  m*/
{
    auto value = AutoFunctionFromReturn(1);
    cout << value << endl;

    return 0;
}

Result


Related Tutorials