ckeywordauto

Where is the C auto keyword used?


In my college days I read about the auto keyword and in the course of time I actually forgot what it is. It is defined as:

defines a local variable as having a local lifetime

I never found it is being used anywhere, is it really used and if so then where is it used and in which cases?


Solution

  • auto is a modifier like static. It defines the storage class of a variable. However, since the default for local variables is auto, you don't normally need to manually specify it.

    This page lists different storage classes in C.