What does auto type specifier do in this line of code (since C++11)?

Advertisement

auto x = 4000.22;

  • It specifies that the type of x will be deduced from the initializer – in this case, double.
  • It specifies that the type of x is automatic meaning that if can be assigned different types of data throughout the program.
  • It specifies that x is a variable with automatic storage duration.
  • It specifies that more memory will be allocated for x in case it needs more space, avoiding loss of data due to overflow.
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment


Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend