Variable in C
×


Variable in C

3301

A variable can be the best defined as a memory location in C Language. In another language, we can say that when we use some data value in a program, we store the data value in a memory space and we give a name to that memory space for an effortless access to it.


A variable is a name given to that address and memory location. The value of variables can be changed easily during execution of the program but constant value can't.

Different data types of Variable are the following:

  • char
  • int
  • float
  • double
  • void

Some Rules regarding the name of Variable:

  • Only capital letters A-Z, lowercase letters a-z, digits 0-9, and the underscore character is only allowed in a variable name.
  • Blank spaces are not allowed in naming variable names.
  • #, $ like special characters are not allowed.
  • Lowercase is preferred in naming variable names as C is case sensitive.
  • No C keywords can be used as variable names.

An easy example of C Variable Program:

#include<stdio.h>

void main()
{
/* c program to print value of a variable */   int age = 32;
printf("I am %d years old.\n", age);
}

Result:

I am 32 years old.



Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments