Automatic Storage Class in C Programming

o Keyword : auto
o Storage Location : Main memory
o Initial Value : Garbage Value
o Life : Control remains in a block where it is defined.
o Scope : Local to the block in which variable is declared.
Syntax :

	auto [data_type] [variable_name];

Example :

	auto int a;

Program :

/*  Program to demonstrate automatic storage class.
Creation Date : 06 Nov 2010 11:05:11 PM
Author : www.technoexam.com [Technowell, Sangli] */

#include <stdio.h>
#include <conio.h>

int main(void)
{
	auto int i=10;
	clrscr();
	{
		auto int i=20;
		printf("\n\t %d",i);
	}
	printf("\n\n\t %d",i);
	getch();
	return 0;
}

Output :
20

10_

Leave A Comment

Your email address will not be published. Required fields are marked *