automatic storage classes

champ1

Jul 17, 2018
55
Joined
Jul 17, 2018
Messages
55
Hi all

I am trying to understand the proper use of storage class in c programming

we can specify a storage class while declaring a variable

Code:
Storage_class Data_type Variable_name ;

For a example,

Code:
#include<stdio.h>

void loop (void)
{
     int count;
    for (count = 0; count <= 10; count++)
    {
        printf("Number :  %d \n", count);
    }
}
int main(void)
{    
    loop();

    return 0;
}

Suppose I have written auto int count; in the above code

I don't see any difference at output of program It gives same output as its giving without auto
 

champ1

Jul 17, 2018
55
Joined
Jul 17, 2018
Messages
55
https://stackoverflow.com/questions/4688816/concept-of-auto-keyword-in-c
According to this page "auto" is the default we use freely as it is the default scope. It contrasts with others such as "static".
So, there is no difference between using the default which is "auto" and explicitly using "auto".
.
Google the other storage classes?
I have been searched but I have confusen I don't know what happen when we write bellow line in the the code
Code:
auto int count;
what it tells to compiler to do ?
 
Top