Monday

variables


variables



1.    Variable is an entity that change during program execution. Example when we write r = 45 i.e. x can hold different value at different times so r is a variable.
2.    A variable may be integer,character,float,double etc..

 Rules for constructing Variable Names :


1.    A variable name must be start with alphabet or underscore.
2.    A variable name is any combination of 1 to 31 alphabets,digits or underscores.
3.    No commas,special symbol(rather than underscore [ _ ] ) or blanks are allowed within a variable name
4.    Example of valid variable names : ram, _ram, d_x, _voids, echo_,  


Properties of variable in c:


  Every variable in c have three most fundamental attributes. They are:

1. Name

2. Value

3. Address

Name of a variable:


Every variable in c has its own name. A variable without any name is name is not possible in c. Most important properties of variables name are its unique names. Not two variables in c can have same name with same visibility. For example:

#include<stdio.h>
int main(){
    auto int a=5;   //Visibility is within main block
    static int a=10; //Visibility is within main block

/* Two variables of same name */
    printf("%d",a);
    return 0;
}

Kindly Bookmark this Post using your favorite Bookmarking service:
Technorati Digg This Stumble Stumble Facebook Twitter
YOUR ADSENSE CODE GOES HERE

0 comments:

Post a Comment

Dont Forget for Commets

 

| C programing tutorials © 2009. All Rights Reserved | Template Style by My Blogger Tricks .com | Design by Brian Gardner | Back To Top |