auto
suggest changeThis storage class denotes that an identifier has automatic storage duration. This means once the scope in which the identifier was defined ends, the object denoted by the identifier is no longer valid.
Since all objects, not living in global scope or being declared static
, have automatic storage duration by default when defined, this keyword is mostly of historical interest and should not be used:
int foo(void)
{
/* An integer with automatic storage duration. */
auto int i = 3;
/* Same */
int j = 5;
return 0;
} /* The values of i and j are no longer able to be used. */
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents