I am getting error like 

```
/hackerearth/CPP14_28/s_e3.cpp: In function ‘int main()’: /hackerearth/CPP14_28/s_e3.cpp:6:10: error: declaration of ‘auto x’ has no initializer auto x; ^ 

```

My code is ,

```
#include <iostream>
using namespace std;

int main()
{
    auto x;
    cin >> x;
    cout << x;
    return 0;
}

```

I want similar functionality that data type should be dynamically assigned
['https://Stackoverflow.com/questions/49578996', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1119372/']
You're misusing the `auto` keyword. **The type that actually gets used is determined by the value used to initialize the variable at compile time.** It has nothing to do with the ability to determine the type of variable to use at runtime.

For example, if you write `auto x = 0`, the compiler sees that you're initializing the variable with an int and pretty much compiles it as if it was `int x = 0`.

Depending on what you're trying to do, you might want to take the input as a string and parse it later, or somehow determine what type of input it is before reading the value.
Objects declared with auto typing need to copy their static type from their initializers; What your 'x' is missing.
C++ - just like C - is a statically typed language. Extra string processing is needed to decode the input string value. If the set of possible types is limited to a known countable set, a proper std::variant could be used to hold the value.