Hacker News new | ask | show | jobs
by mywittyname 1903 days ago
Auto is the implicit default right? As in function scoped, stack allocated, and lives until the function is returned?

K&R (Second Ed). Makes no mention of the auto keyword in Section 1.10, but it does say,

> Each local variable in a function comes into existence only when the function is called, and disappears when the function is exited. This is why such variables are usually known as automatic [sic] variables[...]

1 comments

yes, exactly. That's why there is no need for it in modern c. This compiler however is different: The type is optional (and assumed to be int). Say you have a variable declaration "auto int i;". Back then you could omit int, now you can omit auto.