What are Storage Classes in C ?

Answer Posted / ajith

#include<stdio.h>

void main()
{
int a,s; /*** local variable****/
printf("\n enter the value of a---");
scanf("%d",&a);
s=a+2;
printf("s=%d",a);
getch();
}



output--

enter the value of a--- 5
s=7




example of global variable----

#include<stdio.h>

int a; /***global variable*********/

void main()
{
int s;
printf("\n enter the value of a--");
scanf("%d",&a);
s=a+3;
printf("\n s=%d",a);

mul(); /****another function********/

getch();


void mul()
{
int m;

m=a*2;

printf("\n m=%d",a);
}


output---
enter the value of a----5

s=8

m=10


///*********************************////

Is This Answer Correct ?    70 Yes 27 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can include files be nested? How many levels deep can include files be nested?

660


Why does the call char scanf work?

622


What the different types of arrays in c?

618


How can I read data from data files with particular formats?

607


What are the two forms of #include directive?

646






Why doesnt the call scanf work?

679


write a program to display all prime numbers

1461


What is the benefit of using const for declaring constants?

592


what will be maximum number of comparisons when number of elements are given?

1413


What are qualifiers?

619


What are the features of c languages?

633


Do you know pointer in c?

595


Can you please explain the difference between malloc() and calloc() function?

623


How do we print only part of a string in c?

589


Write a program to reverse a linked list in c.

649